NEW YORK — Henrik Lundqvist didn’t allow a bad ending to the second period wreck an otherwise good day for the New York Rangers.

Lundqvist was the beneficiary of a three-goal lead that was trimmed to two when the Philadelphia Flyers got their power play to work in the closing seconds of the middle period. But the Rangers kept it together in the third, withstood a late surge, and pushed the Flyers to the brink of elimination with a 4-2 victory Sunday.

"The biggest part to me was to calm down and not be too upset about it," Lundqvist said of Vinny Lecavalier’s goal with 32.6 seconds left that made it 3-1. "It is really frustrating to sit here when you give up a goal like that late in the period.

Article continues below ...

"It was just about letting it go and being focused on the right things going into the third."

Brad Richards and Dominic Moore scored in the second to make it 3-0. Lundqvist stopped 24 shots and didn’t face more than 10 in any period. The only other puck that got past him was Claude Giroux’s goal with 1:29 left after the Flyers pulled goalie Steve Mason.

Defenseman Marc Staal gave the Rangers the lead in the first, and Brian Boyle ended the drama with an empty-net goal with 15 seconds remaining. Moore helped seal the win when he raced up ice to negate an icing call and fed Boyle.

New York leads the series 3-2 and can advance to the second round with a win Tuesday in Philadelphia. If necessary, a deciding seventh game would be back at Madison Square Garden on Wednesday.

"We took back the advantage, and we have to win one now," Richards said. "We put ourselves in a good position. We were in control for most of the game. They got a little sneaky there at the end."

Mason wasn’t nearly as sharp in his second straight start following a late-season injury. He stopped 18 shots after his 37-save effort in a 2-1 victory in Game 4 got the Flyers even.

"As you go through a series, you have to keep elevating your game because the other side will," Rangers forward Martin St. Louis said. "I thought we did that, and we got rewarded."

Giroux made things interesting with his first goal of the series. The Flyers went 0-2 during the season at the Garden and are 1-2 there during this series.

"We’re playing well," Giroux said. "It’s a tough building to play in. Game 6 is going to be huge. We are not looking at it like it’s our last game of the season. We’ve come back all season long when it matters, and we’re going to stay confident."

New York is 13-2 in series it has led 3-2, but the Rangers have lost 11 straight games in which they had a series lead.

Philadelphia is 7-10 in Game 6 when trailing 3-2.

The Rangers increased their pressure in tight on Mason, a stated objective, and created multiple scoring chances in the second even though they managed only eight shots.

New York thought it grabbed a 2-0 lead 2:14 in when St. Louis poked in a loose puck in the crease, but the play had been blown dead.

The Rangers took their two-goal lead on Richards’ second of the series and 30th career playoff score. With a crowd around Mason, Richards tucked in a backhander at the left post off assists from J.T. Miller and Carl Hagelin.

Unlike in previous games in which the Flyers rallied after being down 2-0, New York pushed its edge to 3-0 later in the period with a big assist from Philadelphia defenseman Hal Gill, playing his first game of the series.

Gill was unable to handle a rough pass at his blue line from defense partner Braydon Coburn. Moore swooped in to poke the puck behind him and skate in alone. Moore beat Mason for his second of the series and then leapt into the arms of Boyle, sending them both to the ice.

"I tried to kick (the puck) up, and I kicked it back," Gill said. "I have to make that play, and I didn’t. When you’re in the playoffs, you make a little mistake and it costs you."

Philadelphia took advantage on its fifth power play when Lecavalier scored his first of the series and 25th in 68 career playoff games.

The Rangers had six shots on Mason in the first period, but Staal made it 1-0 with his first goal in 29 games, dating to Jan. 26 against New Jersey outdoors at Yankee Stadium.

NOTES: The Rangers put the 21-year-old Miller into the lineup in place of agitator Daniel Carcillo. It was Miller’s career postseason debut. … The 39-year-old Gill replaced defenseman Nick Grossmann, who injured his right knee in Game 4. Gill played in only six regular-season games. … New York was 3 for 12 on the power play in the first two games, but is 0 for 11 since, including 0 for 3 Sunday.