Jaroslav Halak made 30 saves, and Brad Marchand and Torey Krug each had two assists for Boston (5-1-0), which has won two games in a row.
"It's always nice, that's what I'm getting paid for and obviously … we got some goals and obviously overall with my linemates made a couple plays and got a couple good passes from them, a good two points for us in the standings," Pastrnak said.
WATCH: [All Ducks vs. Bruins highlights]
Adam Henrique had a goal and an assist, Rickard Rakell scored, and John Gibson made 19 saves for the Ducks (4-2-0), who finished their four-game road trip 2-2-0. They had allowed six goals in their first five games and have scored 13 in six games.
Anaheim outshot Boston 32-23.
"The key here tonight is that the chances were there," Ducks coach Dallas Eakins said. "If it was a night where you only score two goals and you had no chances at all, I'd be a little bit more worried, but the generation of chances is important. We're going to have to keep generating chances, it can't be a one-off, but we've got to finish now. That's something you have to practice, and it will be something that we'll be on."
Pastrnak scored a power-play goal at 4:18 of the first period to give the Bruins a 1-0 lead. Krug kept Hampus Lindholm's clearing attempt in at the right point and quickly passed to Patrice Bergeron in the slot. Bergeron set up Pastrnak for a one-timer from the left face-off dot.