"It was great to feel that I had the ability to move both ways," said Rask, who faced very few shots early but stopped all 12 that came his way in the third period.
Rask, the winningest goalie in franchise history, has been rehabbing from surgery last summer to repair a torn labrum. He was solid in net Thursday and got plenty of help from his teammates.
Pastrnak scored all three goals for the Bruins, and they held Philadelphia to 27 shots while winning their fourth straight and seventh in eight games.
"He didn't have a ton of work in terms of volume. He's used to that a little bit around here," Boston coach Bruce Cassidy said about Rask. "That's kind of how we play. We're pretty good at limiting volume and D-zone stuff for the most part, trying to keep it outside."
Boston fans greeted Rask with a rousing "Tuuuuuuuk!" when he was the last of the Bruins introduced before the national anthem. But he was mostly idle early as the Flyers didn't get a shot on goal for the first nine minutes.
By then the Bruins were already up 2-0 on goals by Pastrnak, who completed his 11th career hat trick with a power-play goal late in the second period after Philadelphia had scored twice.
"We know they've played a lot of hockey as of late and we did the exact opposite of what our game plan told us to do," Atkinson said. "We got back to it second and third. You saw that we started playing better and guys wanted the puck a little bit more. But yeah, just a slow start for us."
Rask didn't face a shot until a harmless wrister from the blue line from Ivan Provorov at 9:19 of the first period. Rask faced just six shots in the first, none of which were particularly challenging as the Bruins controlled the play and spent most of the period in the Philadelphia end.
"The start wasn't the easiest. There was no shots for the first I don't know how many minutes," Rask said.
Hart had a much busier night, stopping Pastrnak from in close several times after he scored 1:51 into the game and again at 5:27 of the first.
Boston went on a 5-on-3 power play late in the second, and this time there was no stopping Pastrnak, who one-timed a slap shot from the top of the circle past Hart, who had lost his stick a few moments earlier.
Pastrnak's 16th goal of the season put the Bruins up 3-2 and started a flurry of hats coming down from the stands for the second night in a row. Brad Marchand, who assisted on two of Pastrnak's goals along with Charlie McAvoy, had a hat trick Wednesday in a 5-1 win over Montreal.
"Tonight it looked like he could have had five or six goals, to be honest with you," Cassidy said of Pastrnak, who has seven goals in his past four games. "Tonight was his night. The puck was finding him and it's good to see. We needed all three of them. Hopefully he is back feeling great about his game."
Atkinson pulled Philadelphia to 2-1 on a power-play goal 8:02 into the second with a tip of a shot by Provorov from the blue line.
Philadelphia tied it 2-all with five minutes left in the second when Farabee's pass to Atkinson bounced off his skate right back to Farabee, who had Rask out of position and an empty net in which to deposit the tying goal.
Philadelphia had 51 seconds of a 5-on-3 power play after a delay of game penalty on Brandon Carlo and a charging call against Charlie Coyle. The only shot Philadelphia got on net was a slow bouncer that Rask scooped up despite a tip in front by James van Riemsdyk.
The Flyers pulled Hart with more than three minutes left in the third but were unable to get another equalizer.
"He keeps us in every single game," Atkinson said. "We need to be a little harder in our blue in front of him and just help him out a little more."
Information from The Associated Press was used in this report.