Wyatt Johnston, Ryan Suter and Esa Lindell scored for Dallas (34-14-8), which has lost two in a row (0-0-2) after winning its previous three. Oettinger made 25 saves and stopped seven of nine shots in the shootout.
"It's a tough, tough building to play in, even with a full lineup," Stars coach Peter DeBoer said. "I think we recognize that and we showed up, and we worked and played the right way. [We] did a good job."
Pastrnak tied the game 3-3 at 18:15 of the third period. With Swayman out for an extra attacker, McAvoy passed across the zone to Pastrnak, who scored on a one-timer from the left face-off circle.
"Something has to happen to overcome, to get out of the malaise that we were in, results-wise," Bruins coach Jim Montgomery said. "We got the great effort by our goaltender, and then our 6-on-5, our great players made great plays. It's the time where you need to tie the game."