Mike Knuble and Sami Kapanen also scored for the Flyers (7-14-3), who beat Columbus at home 3-2 on Friday and won consecutive games for only the second time this season.
Alex Kovalev and Saku Koivu scored for the Canadiens (13-6-3), who saw their season-high three-game win streak come to an end.
David Aebischer made 22 saves for the Canadiens as he finished a game for the first time in three starts, though he has lost all three.
Antero Niittymaki made 29 saves for the Flyers playing for the second time in two nights, combining to stop 68 of 72 shots in the two games.
Canadiens defenceman Janne Niinimaa dressed after a four-game stint in the press box. He took Mark Streit’s spot in the lineup as head coach Guy Carbonneau dressed seven defencemen for a third straight game, while Francis Bouillon plays himself back into shape from off-season knee surgery.
Defenceman Mathieu Dandenault played mainly as a fourth-line winger and killed penalties as a forward.
The Canadiens were all over a lacklustre Flyers group in the first period but only managed to build a 1-0 lead on Kovalev’s top corner wrist shot from the faceoff circle, his seventh goal of the season.
Niittymaki kept Philadelphia in the game in the first, stopping partial breakaways by Steve Begin and Tomas Plekanec, and he was a bit lucky as well when Sheldon Souray’s slapshot squeezed between his legs but trickled just wide.
The Flyers came out for the second rejuvenated and took it to the Canadiens, outshooting them 15-10 and scoring three times on Aebischer.
Kapanen tied the game 1-1 at 1:34 of the second when he tipped a Joni Pitkanen pass through Aebischer’s legs for his fourth of the season. Knuble put Philadelphia ahead 2-1 at 15:43 when he buried a missed wraparound try by Randy Jones.
Gagne made it 3-1 on the power play at 19:48 when he fanned on his one-timer attempt, but the change-up fooled Aebischer for his 12th of the season.
Koivu got the Habs to within one with a power-play goal at 3:22 of the third, re-directing a Kovalev feed for his sixth of the season to make it 3-2 Flyers.
Montreal had a great chance to tie it when Petr Nedved took a hooking penalty at 16:45 of the third, but Gagne scored an unassisted goal shorthanded at 17:52 for his 13th of the season to make it 4-2.
Notes: – The crowd of 21,273 gave the Canadiens their 70th straight regular season sellout at the Bell Centre . . . Former Montreal Expos outfielder Tim Raines was in attendance. Raines is one of four players honoured on a banner in the Bell Centre rafters for having their Expos jersey numbers retired.