Kevin Hayes, Joel Farabee and Jakub Voracek scored for the Flyers (7-2-2), who were denied a fifth straight win. Carter Hart made 31 saves.
The teams play here again Friday (7 p.m. ET; NHLN, SN, TVAS, NBCSP, NESN, NHL.TV).
"We'd like to close out that victory, but it's part of the game and we just got to adjust," Farabee said. "We play these guys again [in] two days, so we've just got to get ready for that."
Philadelphia killed one of four Boston power plays.
"[We] gave an opportunity to their top players to step on the ice," Flyers coach Alain Vigneault said. "They're elite players and they found a way to make a difference in the game."
Pastrnak gave Boston a 1-0 lead when he carried the puck on the left side of the Flyers zone, dropped it between his skates to get around Flyers defenseman Shayne Gostisbehere, shifted the puck from his backhand to his forehand and scored.
The hat trick came after Pastrnak scored two goals in a 5-3 win at the Washington Capitals on Monday; it's the fourth time he's scored multiple goals in consecutive NHL games.
"I told him in my experiences, sometimes what happens with guys when they miss that much time, or it's a whole offseason, is you lose your timing a bit, your hands and your timing are a little bit out of sync, but he showed me," Bruins coach Bruce Cassidy said. "Usually your legs are there because you've been skating lots, but that's not the issue; it's the bumping and the grinding and the timing of taking a pass, not getting hit and all that. Obviously he's on a mission. Good for him. We need it.
"He's a guy that he's here and predominately he's a scorer and you need those guys to win hockey games for you. He's done that the last few nights. Clearly looks energized, ready to play and we're thankful for it and grateful."