PHILADELPHIA -- The Toronto Maple Leafs lost ground for second place in the Atlantic Division with a 5-4 shootout loss to the Philadelphia Flyers at Wells Fargo Center on Wednesday.

The Maple Leafs are six points behind the Boston Bruins, who defeated the New York Rangers 6-3 on Wednesday.
"Just a sloppy second period is where we hurt ourselves," Toronto forward Nazem Kadri said. "Overall through 40 minutes I think we played a pretty solid road game, but that second period, they pushed and we didn't have an answer so that put us behind a little bit."
WATCH: [All Maple Leafs vs. Flyers highlights]
Auston Matthews had a goal and an assist, and Frederik Andersen made 40 saves for Toronto.
The Flyers (37-32-8) would have been eliminated from Stanley Cup Playoff contention with a loss in regulation. They are eight points behind the Montreal Canadiens for the second wild card into the playoffs from the Eastern Conference with five games remaining.
Sean Couturier scored during the Flyers' three-goal second period and had the deciding goal in the fifth round of the shootout. Carter Hart made 38 saves.
"A few years ago I scored on Andersen (in a shootout) when he was in Anaheim with the same move," said Couturier, who used a head fake and went forehand to backhand. "I wondered if he remembered me, and thankfully he probably didn't and it worked again. Just happy to get the win here."

The Maple Leafs took a 2-0 lead in the first period on goals by Connor Brown at 5:03 and by Kadri at 12:02.
But the Flyers responded with three goals in the second period to take a 3-2 lead.
Travis Konecny made it 2-1 at 3:39, Radko Gudas scored through a Ryan Hartman screen to tie it 2-2 at 8:15, and Couturier put the Flyers ahead 3-2 at 15:46. He won a puck battle in the Maple Leafs end, then skated into the slot and tipped a Travis Sanheim pass between Andersen's skates.

Dunkin' NHL Comebacks: Flyers soar past Maple Leafs

"I really liked our start," Toronto coach Mike Babcock said. "I was disappointed because I think we've really worked hard to get our game back here of late. I was disappointed in our second period. I thought we let ourselves down with that. There's no reason to be careless with the puck and not take care of it."
Matthews scored from a sharp angle off his rebound 1:43 into the third period to make it 3-3, but Hartman scored at 9:00 to put the Flyers ahead 4-3.

TOR@PHI: Matthews goes bar down for equalizer

Philadelphia coach Scott Gordon said he wasn't surprised by his team's resilience.
"I don't think you go from being in last place in the League and whatever amount of points out of the playoffs in mid-January, and play yourself back into playoff consideration, and then all of a sudden throw that all away and say, 'Well, the season's over here, we've got six games left, let's go through the motions.' There has to be an element of character that always comes to the forefront, and I'd like to think that's the way our team will finish off the season."
The Maple Leafs forced overtime on William Nylander's goal at 11:33 of the third period to make it 4-4. It was his first goal in 14 games.
"It's been a while, but the chances have been there so I wasn't too worried," Nylander said. "Rather score in the playoffs than now, but it was good."

TOR@PHI: Nylander capitalizes on the forecheck

They said it

"I didn't mind our first, I didn't mind our third, the second got us in trouble. A team that is in the position we're in, if you just come out and you do it right, you give them no life, you make it hard on them. We gave them some life there in the second period." -- Maple Leafs coach Mike Babcock
"The first shooter (in the shootout) was one of my good buddies from back home, Tyler Ennis. I've been skating with him back home in the summer since I was 16 so I knew some of his tendencies. Kind of laughing when I saw him come up. First shootout attempt, it's [Ennis], so no big deal." -- Flyers goalie Carter Hart, who made the save on Ennis

Clutch Performance: Hart stops 38 shots in victory

Need to know

Toronto forward Patrick Marleau played his 1,652nd NHL game, tying Mark Recchi for fifth. … The Maple Leafs went to the shootout for the first time this season. … Toronto has a four-game point streak (2-0-2) ... Kadri's goal was his first in 13 games. ... Couturier's goal gave him an NHL career-high 32. He had 31 last season. ... Forward Jakub Voracek played his 600th game for the Flyers. ... Philadelphia defenseman Samuel Morin had a shot on goal, three hits and three blocked shots in 8:09 of ice time in his season debut. It was his first game since he tore the ACL in his right knee May 9, 2018, while playing for Lehigh Valley during the American Hockey League playoffs.

What's next

Maple Leafs: At the Ottawa Senators on Saturday (7 p.m. ET; CBC, SN1, SNO, TVAS2, NHL.TV)
Flyers: At the Carolina Hurricanes on Saturday (1:30 p.m. ET; ESPN+, FS-CR, NBCSP, NHL.TV)