Hayes' goal was his first point of the season and his first goal since Feb. 24, 2016, against the Pittsburgh Penguins.
"It feels really good. It's been a while," Hayes said. "To be able to contribute and get a goal and start moving in the right direction, that's what the plan is."
WATCH: All Lightning vs. Bruins highlights
Ben Bishop made 26 saves for the Lightning (13-9-1), who started a three-game road trip by losing for the second straight game and third time in their past four. Victor Hedman scored with 2:39 remaining in the third period to end Rask's shutout bid.
"Really, it was just a nothing game. We were having a good road game and then basically it was blown assignments," Lightning coach Jon Cooper said. "That's the tough part. ... Big picture, the guys played hard. Every time we made a little mistake they put it in the net, and that's tough."
The Bruins were already without injured defenseman Zdeno Chara (lower body) for the third straight game when they lost defenseman John-Michael Liles at 5:07 of the first period. Liles crashed into the end wall after colliding with Bishop's stick outside the Tampa Bay crease. He was helped off the ice with an upper-body injury and did not return.
Boston was down to four defensemen because Krug was in the penalty box for the first 8:46 of the second after a minor penalty for slashing and a major for fighting. That didn't stop the Bruins from taking control of the game.