The Flyers moved within three points of Boston for the final playoff spot in the NHL's East division.
Travis Konecny and Sean Couturier each scored for Philadelphia, and Brian Elliott stopped 27 shots. The Flyers were 2-4-2 in their previous eight games.
''Tonight was just a big game for us,'' Konecny said. ''We know where we are and where they are in the standings. We know what's at stake going forward.''
Patrice Bergeron had a second-period goal for Boston that moved him into fourth on the club's all-time scoring list with 899 points, one ahead of Rick Middleton.
Karson Kuhlman also scored for the Bruins, who have collected at least a point in seven of their last nine games (5-2-2). Dan Vladar made 29 saves.
''There were some good things,'' Boston coach Bruce Cassidy said. ''We took a lead into the third and took a bad penalty. ... Unfortunately, in overtime we had a couple of pucks on our stick and we weren't able to get to the net and past the goalie, and they did.''
Vladar robbed Sanheim's close bid with a sprawling right-pad stop while on his stomach in the opening minute of OT, but the defenseman cut in alone and beat him with a wrister from the slot.
''I think we knew it was a big game coming in,'' Sanheim said. ''We needed to get the two points. Obviously, we would have liked to get it in regulation.''
Bergeron's milestone made it 2-1 just 46 seconds into the period. With Boston on the power play, David Pastrnak fired a pass from the left point that Bergeron, positioned in the slot, redirected into the net. It was Boston's ninth power-play goal against the Flyers this season.
Couturier's rising wrist shot from the left circle tied it on the power play 6:56 into the third.
''It's a big extra point we got there,'' Couturier said. ''We're battling for a playoff spot.''
After Boston took a 2-1 lead, Vladar robbed Konecny's power-play bid by cutting quickly across the crease to stop a shot with his upper body. With just under 4 1/2 minutes left in the period, the Boston goalie dropped to make a pad save on Justin Braun's partial breakaway.
''I'm living my dream and enjoying every second out there and trying to do my best,'' said Vladar, who has picked up more of the load with No. 1 goalie Tuukka Rask injured.
THIS TIME IT COUNTS
On Saturday, Bergeron briefly moved into fourth on the club's scoring list, but he had an assist taken away by a scoring change after the game, leaving him tied with Middleton.
Cassidy said after the morning skate that No. 2 goalie Jaroslav Halak tested positive for COVID-19. With Rask still sidelined with an undisclosed upper-body injury, it left the Bruins with two goalies who started the season in the minors. Jeremy Swayman backed up Vladar.
Boston forward Jake DeBrusk was back after missing six games due to COVID-19 protocols.
The Flyers recalled defensemen Samuel Morin and Shayne Gostisbehere to the roster from the taxi squad. Both played on Monday.
The teams meet again Tuesday night in Philadelphia, and Flyers coach Alain Vigneault acknowledged before the game how important the two games were for his team.
''This morning we definitely talked about it as a team. This is playoff hockey for us,'' he said. ''The importance of it we're very aware of.''
More AP NHL: https://apnews.com/hub/NHL and https://twitter.com/AP-Sports
Copyright 2021 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.