Daniel Winnik and Joe Pavelski each scored for the Sharks, who snapped a two- game losing streak to keep pace in the tightly contested Western Conference postseason race.
San Jose has 84 points on the season and sits one point out of the playoff picture in the conference.
Zdeno Chara had a late goal while Tim Thomas made 25 stops for the Bruins, who had won two straight and with 87 points sit two ahead of Florida for the second spot in the Eastern Conference. Also, the Bruins hold a three-point lead over Ottawa for the top seed in the Northeast Division.
The first period saw San Jose score just 3:57 in when Joe Thornton skated the puck around the net to the left side and centered it for Patrick Marleau, whose one-timer was stopped with Pavelski cleaning up the rebound from the right.
The score stayed that way through the second and the Sharks took a 2-0 lead 2:17 into the third. Andre Desjardins flew down the right wing and fired the disc over to the left circle where Winnik blew a wrister past Thomas.
Boston made things interesting when Chara got the puck at the left circle and skated behind the goalline before firing a shot that went off the chest of Niemi and ended up in the back of the net with 4:15 to play.
That was it, though, as the Sharks were able to keep the Bruins from knotting up the contest.
San Jose hosts Phoenix on Saturday...Boston plays in Los Angeles on Saturday...The Sharks have won three straight over the Bruins.