MONTREAL - With Flyers defenseman Chris Pronger injured and in the locker room, the Montreal Canadiens turned the third period into their own personal shooting gallery Wednesday night.

But the Flyers withstood the Canadiens' furious comeback and won it with a counterattack of their own, outlasting Montreal, 5-3, at the Bell Centre.

They took the lead for good on James van Riemsdyk's second goal of the night, a power-play tally with 5 minutes, 33 seconds left.

Van Riemsdyk knocked in a rebound after Jeff Carter's shot was turned aside by Carey Price, and Nik Zherdev won a battle for the loose puck.

The recently formed Carter line had the first four Flyers goals, with Carter and Zherdev also scoring.

About a minute after van Riemsdyk's goal, Claude Giroux converted a Mike Richards pass to make it 5-3. It was Giroux's 16th goal, equaling his output for the entire 2009-10 season.

After Zherdev's wrap-around goal gave the Flyers a 3-1 lead early in the third period, Montreal stormed back. The Habs got goals from Tomas Plekanec and Brian Gionta - a soft goal that trickled through Sergei Bobrovsky's pads - to tie the score at 3 with 10:05 left.

Gionta's goal helped negate a sensational first two periods by Bobrovsky, but the Flyers recovered nicely.

As for Pronger, he played 15:54 in the first two periods but suffered what the team called a lower-body injury and did not play in the final period.

Bobrovsky was showing a little wear and tear when he was given a rest last Thursday. It turned into a three-game break because Brian Boucher, his replacement, did such a superb job that coach Peter Laviolette was reluctant to remove him.

Getting his first start since a 5-4, shoot-out loss to San Jose a week earlier, Bobrovsky was razor-sharp in the opening period, making a handful of difficult stops to keep the game scoreless.

The Flyers, who entered the game with a 4-1-2 record in the second night of back-to-back contests this year, had Richards centering Giroux and Andreas Nodl for the second straight game. van Riemsdyk, who had been on Richards' line until Tuesday, was with Carter and Zherdev.

In the last two games, Giroux and van Riemsdyk flip-flopped lines. Carter was back at his favorite spot - center - and Giroux was shifted to right wing on the other line.

The Carter line produced the first two goals Wednesday.

Carter liked having more skating room, and he demonstrated his speed as he scored his 13th goal and gave the Flyers a 1-0 lead with 17.6 seconds left in the first period.

Skating past defenseman Alexandre Picard, Carter darted through the right circle, cut in front, and beat Price with a backhander.

About nine minutes earlier, van Riemsdyk nearly gave the Flyers a 1-0 lead, but his left-wing shot clanked off the right goalpost.

The Canadiens had numerous great chances in the opening period, but Bobrovsky had all the answers.

With 9:06 to go in the first, he stopped Michael Cammalleri, then made a spectacular save on Andrei Kostitsyn's rebound.

With a little under seven minutes to go, he made a lightning-quick glove save to thwart Mathieu Darche's point-blank shot, and he somehow stopped Roman Hamrlik during a goalmouth scramble in the first period's closing seconds.

A rejuvenated van Riemsdyk, who had not scored in his first 17 games, gave the Flyers a 2-0 lead when he scored from a tough angle on the left, whipping a shot that appeared to deflect off defenseman Hal Gill and over Price with 17:27 left in the second. It was van Riemsdyk's sixth goal - all in the last 12 games.

"I just threw it toward the net and it hit off their skate and went in," van Riemsdyk said.

Bobrovsky made several spectacular saves before Montreal sliced the deficit to 2-1 with 1:51 left in the second period. P.K. Subban, who got into a scuffle (and a war of words) with Richards in the Flyers' previous visit here, scored on a one-timer from the left circle with the Canadiens on a five-on-three power play.

The Flyers were 17-0-2 when taking a lead into the third period; conversely, the Habs, who had a 27-18 advantage in shots after 40 minutes, were 0-9 when trailing after two periods.