The 29-year-old Markov was due to become an unrestricted free agent July 1.
Markov was fourth in team scoring this season, second among the club's defencemen with six goals and 43 assists in 77 games.
"Andrei Markov is one of our best players, and a huge part of our hockey team," Habs GM Bob Gainey said in a release. "We drafted and developed a player who has become an elite defenceman in the NHL. His desire to remain a member of the Canadiens' organization was evident, and today we are very pleased to have a long-term agreement with Andrei."
In 411 career games with Montreal, the Russian blue-liner has 46 goals and 161 assists.
Markov, who was drafted by the Habs 162nd overall in 2000, has also played on the international stage, representing Russia at four IIHF World Hockey Championships, two world junior championships and the 2006 Winter Olympics.