Financial terms of the deal weren't disclosed.
Harbaugh took the Ravens to the playoffs in each of his three seasons after replacing Brian Billick as coach in January 2008. Baltimore is 32-16 in the regular season under Harbaugh and 4-3 in the playoffs.
Ravens owner Steve Bisciotti assured Harbaugh last month that an extension was forthcoming, and the team delivered on that promise after lengthy negotiations.
"Steve said that we want to make sure John remains as our head coach. We reached a new agreement late last week and Coach signed it (Monday) morning," Ravens president Dick Cass said in a statement released by the team. "Having John increases our opportunity to compete for the NFL championship every year, which is our goal."
"This is much appreciated, and I am thankful to Steve," Harbaugh said in the team-issued statement. "I want to stand shoulder-to-shoulder with him, (general manager) Ozzie (Newsome), Dick, our players and everyone else in the organization as we work to bring championships to Baltimore.
"We have a lot of great people who are Ravens. I'm proud to be part of this. We all push each other and pull together. I said it when I came here: 'It's about the team.' And, we plan to be a championship team."
Copyright 2011 by The Associated Press