The Canadiens almost let it slip away.
With a three-goal lead going into the final period on Saturday, Montreal conceded three straight goals to Detroit, including two in 36 seconds, but ultimately held on for the 5-3 victory.
Pavel Datsyuk scored his 16th of the year at 5:11 on the power play, and Luke Glendening reduced the deficit again at 5:47 on a soft backhand shot that Carey Price got a piece of but couldn't keep out.
Niklas Kronwall tied it up for Detroit midway through the third, beating Price with a rocket of a slap shot from the point, through traffic, on the man advantage.
Instead of keeling over, however, the Canadiens answered Kronwall's game-tying goal with renewed energy.
"At that point, you just reset, and go back to what made you successful in the first half of the game," said Montreal captain Brian Gionta. "You have to make sure you don't lose that momentum. It's much easier at home, when you have the crowd. You build some momentum off of them. You make a good play, and things start to snowball the right way again."
With seven minutes remaining in a 3-3 game, Gionta helped right the ship. He was credited with his second goal of the evening when his shot, which was initially saved by Detroit netminder Jonas Gustavsson, bounced off defenceman Brian Lashoff's skate and into the net.
Alex Galchenyuk added a fifth for the Canadiens two minutes later when a Tomas Plekanec shot deflected off his chest and past Gustavsson, who stopped 19 shots in the loss.
"That's proof that there's a lot of character on this team," said forward Michael Bournival. "We've done this a few times this year. Even if we concede three straight goals, we're able to bounce back. We knew the Red Wings never give up. They had us on our heels to start the third, but we got back on our feet."
The red-hot Canadiens (45-27-7) are now 10-2-0 in their last 12 games. With the victory, Montreal remains in second place in the Atlantic, four points clear of division-rivals Tampa Bay, which lost on Saturday.
The Habs play three more times - against the Blackhawks, Islanders and Rangers - before the start of their first-round playoff series.
Montreal got a goal from each of its four lines against the Red Wings (37-27-14).
"We need that depth in scoring," said Gionta. "That's going to help us down the stretch. We can't just rely on one line. We're a much deeper team now."
Fourth-liner Bournival scored the first for the Canadiens, his seventh of the year and first in 37 games, at 14:16 of the first period.
The rookie got the play going, intercepting the puck in the neutral zone before feeding Ryan White at the blue-line. White held off defenceman Kyle Quincey and took a weak backhand shot on Gustavsson, who kicked the puck straight to a wide-open Bournival.
"That's Ryan White's goal," said Bournival. "He charged the net. He made all the effort. I just had an open net. It felt good. But all the credit goes to Ryan."
Max Pacioretty made it 2-0 on a great individual effort at 8:52 of the second, going around Kronwall with speed at the Canadiens' blue-line to generate a breakaway. Pacioretty fended off a diving Lashoff before beating Gustavsson blocker-side for his ninth goal in his last eight games.
With his 39th goal, Pacioretty moved into a tie with Joe Pavelski of the San Jose Sharks for third in NHL scoring.
Gionta got in on the action five minutes later, scoring his first of the night after a set play off the end boards landed perfectly on his stick, unmarked in front of the net. The goal was Montreal's second in the period on only their third shot.
Montreal's victory snapped Detroit's four-game winning streak. The Red Wings, with 88 points, are holding on to the first of two wild card spots in the East.
"We have to be better than we were tonight," said Wings coach Mike Babcock. "We've been on a good run here where we play hard. I didn't think there was a problem with our energy or our commitment to working hard tonight. We didn't execute well enough with the puck."
The Red Wings outshot the Canadiens 37-26, including 15-4 in the second period. But they were repeatedly frustrated by Price, who made 34 saves on the night.
"Let's face it. We had the puck a lot, and we didn't find a way to win, that's all," added Babcock. "When you're tied in the third, you need to find a way to win, and we couldn't do that."
Both Montreal and Detroit were coming off wins on Friday. The Red Wings scored three times in the first period to beat the Buffalo Sabres 3-2, while the Canadiens scored seven straight to down the Ottawa Senators 7-4. Both Price and Gustavsson had the night off on Friday.
Notes: The game was Gionta's 300th with Montreala Forwards Brandon Prust (upper body), Travis Moen (concussion) and Dale Weise (upper body) did not dressa Defenceman Douglas Murray served his second of a three-game suspension for his elbow to the head of Tampa Bay's Mike Kostkaa The Red Wings are seeking a 23rd consecutive playoff appearance.