PHILADELPHIA - The Toronto Maple Leafs did their best to spoil Philadelphia's playoff chances until the final minute of regulation.

Jake Gardiner scored a power-play goal at 2:51 of overtime to give the Maple Leafs a 4-3 victory over the Flyers on Thursday night. But Philadelphia maintained control of its playoff hopes by earning a point thanks to Wayne Simmonds' tying goal with 58 seconds left.

The Flyers are a point behind Boston and Detroit for the eighth seed in the Eastern Conference. Philadelphia would secure a playoff berth by winning its last two games. The Bruins and Red Wings each have one game left and one of them is guaranteed a playoff berth that goes to the third-place team in the Atlantic Division.

If either Boston or Detroit loses Saturday afternoon, the Flyers would clinch with a win at home over Pittsburgh later in the day.

"If you would've told us two months ago, we'd be in this position, we'd take it," Flyers captain Claude Giroux said.

After goalie Steve Mason was pulled for the extra skater, Simmonds redirected Mark Streit's slap shot for his career-best 30th goal, helping the Flyers rally for a crucial point.

The Leafs won it after Andrew MacDonald went to the penalty box for tripping. Gardiner ripped a slap shot past Mason to win it for the Leafs. The Flyers were upset the goal wasn't disallowed because of goaltender interference, but a video review made it stand.

"It seems every game the rule is different," said Jakub Voracek, who had his own goal nullified because of goalie interference on Giroux in the second period.

William Nylander, Colin Greening and Michael Grabner also scored for Toronto, which will miss the playoffs for the third straight year and 10th time in the past 11 seasons. Jonathan Bernier made 41 saves in his final start.

"It was a really tough season for me, but I played every game hard and it meant a lot to me to show I have a lot of character and to finish strong," said Bernier, who was demoted to the minors earlier in the season.

The Leafs are tied with Edmonton for fewest points in the NHL with one game remaining for each team. If the Leafs finish last, they'll have a 20 per cent chance of winning the draft lottery and landing the No. 1 overall pick. If they finish behind the Oilers, those odds drop to 13.5 per cent.

"Drafting for our organization is very important," Leafs coach Mike Babcock said. "We've taken it on the chin all year so we can be set up for it. At the same time, we have to respect one another in the game and play it the right way."

Brayden Schenn and MacDonald also scored goals for the Flyers. Mason allowed two breakaway goals in his 11th consecutive start.

Trailing 3-1 and probably aware the Bruins were easily beating the Red Wings, the Flyers started their comeback when MacDonald ripped a slap shot past Bernier with 11:27 remaining. It was MacDonald's first goal since Jan. 3, 2015, a streak of 55 games without one.

Down 2-0 after 20 minutes, the Flyers came out with more urgency to start the second period and scored 29 seconds in. Sean Couturier took a pass from Sam Gagner and streaked down the left side. He made a nifty, spinning, backhanded pass to Schenn, who beat Bernier for his 26th goal.

The Flyers missed an opportunity to tie it during a four-minute power play after Tobias Lindberg went to the penalty box for a double-minor for high-sticking. Voracek's disallowed goal was their best chance.

The Leafs increased the lead to 3-1 when Grabner intercepted Simmonds' pass in Toronto's zone, skated all alone up the middle and beat Mason for his ninth goal.

Nylander gave the Leafs a 1-0 lead early in the first period on his sixth goal in just 21 games this season.

Greening made it 2-0 about 10 minutes later when he took a pass from Nylander, broke in alone against Mason and lifted a shot into the top corner.

"We weren't sharp enough early," Flyers coach Dave Hakstol said. We gave up two easy goals."

NOTES: Flyers G Michal Neuvirth returned to the bench as Mason's backup after missing 10 games with a lower body injury. ... Toronto ends its season Saturday on the road vs. the Devils. ... Giroux won the Bobby Clarke Award for team MVP. ... The Flyers finish at the New York Islanders on Sunday.