PHILADELPHIA (AP) — Wayne Simmonds just had to tap the puck over the blue line but couldn’t. Then Andrew MacDonald fanned on a clearance.

Patrice Bergeron pounced on the extra chances, tying it for the Boston Bruins with 3.8 seconds left and leaving the Philadelphia Flyers stunned.

It took Jakub Voracek’s pep talk and Claude Giroux’s acrobatics to finally give Philadelphia a crucial win.

Giroux scored his second goal with 1:21 left in overtime and the Flyers recovered for a 4-3 victory over Boston on Sunday to inch closer to returning to the playoffs after a year absence.

“The play at the end of the game is a play that can’t happen. We all know that,” Flyers coach Dave Hakstol said of the stick-handling mishaps. “Take that puck and just push it out to the neutral zone.”

Dazed ahead of OT, Voracek implored his teammates to stay focused. Voracek then sprung Giroux on a breakaway. The captain faked out goaltender Anton Khudobin by acting like he was going to take the puck through his legs, only to snap a backhander for his career-best 29th goal.

“I just thought I’d try that,” Giroux said, grinning.

Travis Konecny added a dazzling goal and an assist, Nolan Patrick also scored and Petr Mrazek made 36 saves for the Flyers. Philadelphia opened an eight-point lead over idle Florida, the last team that can overtake it for the final playoff spot in the Eastern Conference — the Flyers have three games left and the Panthers five.

Bergeron helped the ailing Bruins earn a point. With the goaltender pulled, Bergeron got his 30th goal on feed from Brad Marchand after the Flyers’ miscues.

“We didn’t have a ton of control, but we continued to stay on it,” Marchand said. “Tried to force them to make plays, turn a couple of pucks over and it ended up in the net.”

Noel Acciari and David Pasrnak scored and Khudobin stopped 20 shots for the Bruins, who lost Brandon Carlo and Riley Nash to injuries a day earlier.

The Bruins welcomed Zdeno Chara back from an upper body injury a day after losing fellow defenseman Carlo to a possible serious leg injury, but they couldn’t complete a season sweep of Philadelphia.

“We got the point, but losing (stinks), Khudobin said.

Boston moved two points ahead of Tampa Bay atop the the Atlantic Division. The Lightning played later Sunday against Nashville.

A day after Vegas’ Willam Karlsson’s short-handed, between-the-legs goal was declared by many to be the NHL’s top goal this season, Konecny provided competition. His nifty stick work made it 2-0 just 25 seconds into the second period.

Konecny flicked the puck between two defenders along the boards, regained possession in the faceoff circle, went to his backhand to slip past a flailing Bergeron and then quickly switched back to his forehand and beat Khudobin from the slot for his 24th goal.

“I think it was just instinct. I reacted,” Konecny said. “When it happens, you’re just in the moment.”

But it was Giroux, who has a career-high 95 points, that came up with the final and most important tricky stick work.

“I’ve seen some great highlight-reel goals throughout the year,” Hakstol said, “but I don’t think I’ve seen a better one than that.”

NOTES: Bruins D Torey Krug said he was hit in the face by Patrick’s high stick just before Patrick’s goal made it 3-1. . Flyers G Alex Lyon was recalled on an emergency basis to back up Mrazek as Michal Neuvirth (lower body) was unavailable. No. 1 G Brian Elliott (abdominal surgery) practiced Saturday and could return this week. . Bruins D Charlie McAvoy (knee) skated before the game and could return Tuesday. . Marchand, who was named the NHL’s second star of March, took a penalty when he cross-checked Andrew MacDonald in the face late in the second period.