David Pastrnak scored to tie Patrice Bergeron for third on Boston’s all-time goals list (427), and James Hagens, Casey Mittelstadt and Fraser Minten each had a goal and assist for the Bruins (9-2-1), who are 7-0-1 in their past eight. Elias Lindholm and JJ Peterka each had two assists, and Jeremy Swayman made 22 saves.
Michael Misa, Kiefer Sherwood, Dmitry Orlov and Will Smith scored, and Jacob Trouba had two assists for the Sharks (6-5-1), who concluded a six-game road trip (3-2-1). Alex Nedeljkovic made 29 saves.
Pastrnak, just out of the penalty box, knuckled a wrist shot from the top of the right face-off circle past Nedeljkovic to tie it 3-3 at 8:27 of the third. Hagens then gave the Bruins a 4-3 lead at 9:07 when he scored from the edge of the crease, before Minten increased the lead to 5-3 at 12:00 by knocking in a rebound on the power play.
Smith scored 27 seconds later with the teams at 4-on-4 to cut the deficit to 5-4 at 12:27, but Will Borgen scored an empty-net goal at 19:32 for the 6-4 final.
Mittelstadt gave the Bruins a 1-0 lead at 3:08 of the first period. After a strong Boston forecheck forced the puck loose, Lindholm chipped it across the crease to Mittelstadt, who tucked it in from the right side.
San Jose tied it 1-1 on the power play at 5:54. Tyler Toffoli sent the puck in from near the right wall, and it took a deflection before Misa tapped it in at the far post.
Marat Khusnutdinov’s goal on the backhand made it 2-1 for the Bruins at 8:20 of the second period.
Sherwood then tied it 2-2 on a short-handed breakaway at 13:34. He intercepted a pass from Lindholm in the neutral zone and beat Swayman with a high wrist shot to the stick side.
Orlov gave the Sharks a 3-2 lead at 4:03 of the third, scoring with a one-timer from the point.