NEW YORK -- The Philadelphia Flyers ended an eight-game losing streak and gained a point in the wild-card race by defeating the New York Rangers 4-1 at Madison Square Garden on Thursday.

Travis Konecny had a goal and an assist, Ryan Poehling had two assists, and Cam York, Bobby Brink and Noah Cates scored for the Flyers (37-32-11), who were 0-6-2 in their previous eight games, including a 9-3 loss to the Montreal Canadiens on Tuesday. Samuel Ersson made 24 saves.

The Flyers are one point behind the Pittsburgh Penguins for the second wild card into the Stanley Cup Playoffs from the Eastern Conference, tied with the Washington Capitals and Detroit Red Wings. Philadelphia has two games remaining; Pittsburgh, Washington and Detroit each has three to play. 

"We were saying we're back to being the underdogs, kind of where people thought we were at, counting us out," Cates said. "So, back to where we've felt comfortable. Playing against one of the top teams in the League, everyone is doubting us and we stepped up and had a great effort."

Philadelphia is home for its final two games, against the New Jersey Devils on Saturday and the Capitals on Tuesday.

"We win and we get to fight another day," Flyers coach John Tortorella said. "We're going to have to do the same thing when we play Saturday. We're going to have to be ready to go and see if we can extend this."

Artemi Panarin scored his 47th goal and Jonathan Quick made 23 saves for the Rangers, who have lost two in a row in regulation for the first time since Jan. 18-20.

"The whole game wasn't good enough," Rangers center Mika Zibanejad said. "We knew they were going to be desperate. We didn't match their intensity or desperation level. We don't execute what we're supposed to do. We're slow to do things. Just overall not good enough."

The Rangers (53-23-4) have a three-point lead on the idle Carolina Hurricanes for first place in the Metropolitan Division. New York has two games remaining, both at home, against the New York Islanders on Saturday and Ottawa Senators on Monday. Carolina has three games to play.

"We're fighting for the division right now," defenseman Ryan Lindgren said. "Carolina is right on our tail. There's no time for us to let up. We've got two games left. We want to play good hockey and be ready for the playoffs obviously."

York gave the Flyers a 1-0 lead, scoring from the left circle at 4:21 of the first period. The Flyers scored first twice in their eight-game skid.

Konecny pulled up with the puck on the far side, causing K'Andre Miller to lose an edge and go down. He found York coming into the zone, setting him up for the shot off the rush.

"It just gives you that energy," Tortorella said. "I thought we lost ourselves a little bit there when we took the penalties and they scored, but we kept our patience."

Panarin tied it 1-1 with a 5-on-3 power-play goal from the left circle at 18:19.

Brink made it 2-1 at 3:29 of the second period, when his attempted pass to Poehling, who was cutting across the front of the net from left to right, went in off Miller's stick.

"The harder you work the luckier you get," Cates said. "That's what I believe and what just happens in this weird game. It was nice to get some bounces, but you can't rely on them, obviously."

PHI@NYR: Poehling, Brink team up to score

Konecny made it 3-1 at 19:13, scoring from the left circle after stripping the puck from Zibanejad and starting a rush out of the defensive zone. He found Poehling up the right side. Poehling waited for a lane and moved the puck to Konecny for his shot past Quick's glove.

"I kind of ran out of position a little bit defensively and then we got back," Konecny said. "It's been part of our success this year waiting for opportunities on transition. We got a turnover, and all the forwards and York did a great job driving the net and creating space, and 'Pales' made an awesome play."

Cates made it 4-1 at 5:56 of the third period with the Flyers’ fourth goal off the rush. He kept the puck on a 2-on-1 through the right circle before scoring glove side on Quick.

"I don't think we made good decisions," Rangers coach Peter Laviolette said. "I don't think the urgency was there to pick up the rush the way we needed on the way back into our zone, coming into 'D' zone coverage. That was definitely an issue."

The Flyers held the Rangers to two shots on goal in the third period.

"We were clean through the neutral zone," Tortorella said. "We didn't do anything laterally when we didn't have to. I thought our sticks were good. We just simplified things, a lot of flips, just getting it out of our end zone as quick as possible. I think it's something we can lean on here for the next couple. We'll see where we go. Fight another day."

NOTES: Konecny has 32 goals and 20 multipoint games, the most he's had in a single season in each category. … Panarin has at least one point in 65 games this season, the most in a season by a player in Rangers history. He has a point in 11 straight games. … The Rangers are one away from breaking the team record for most wins in a season.