Chad Johnson made 20 saves, and Chris Kelly, Jarome Iginla, Patrice Bergeron and Andrej Meszaros also scored for Boston. The Bruins are 7-0-3 during a 10-game stretch on the road, their longest such point streak since 2010-11.
The Bruins have taken 14 of 16 from the Panthers, including eight straight by a combined 33-10 score.
The Bruins broke a 1-1 tie on Krug's goal with 12:22 left the third. Krug took a pass from Brad Marchand in the slot and backhanded it past Luongo.
Three goals were scored in a span of 52 seconds in the third, two by Boston.
The Bruins stretched their lead to 3-1 on Bergeron's goal with 6 seconds left on a power play His one-timer went between Luongo's pads at 11:21.
The Panthers closed to 3-2 when Hayes found a loose puck in front and jammed in between Johnson's pads for his second goal at 11:42.
The Bruins made it 4-2 on Iginla's goal 31 seconds later when his wrist shot went over Luongo's shoulder at 12:13 for his 20th of the season.
Kelly scored an empty-netter with 1:02 left.
The Bruins tied it at 1 on a power-play goal by Meszaros. His slap shot from above the right circle got past Luongo at 9:58. It was the first goal Luongo gave up in nearly 90 minutes since rejoining the Panthers for Friday's 2-0 win against Buffalo.
The Panthers took a 1-0 lead on Hayes' first goal at the 7-minute mark of the second. Nick Bjugstad shot from the right side and Johnson made the block, but Hayes grabbed the rebound and wristed it into the open net on the stick side.
The Bruins went after Luongo from the start. He faced a barrage of 27 shots in the first two periods, with at least three hitting the post, including a deflection off the skate of Panthers defenceman Brian Campbell early in the second that glanced off the iron.
NOTES: Bruins F Daniel Paille left with an upper-body injury after being hit by Ed Jovanovski along the boards at 3:06 of the first and did not return. ... Meszaros made his Bruins debut after being acquired from Philadelphia last Wednesday. ... Corey Potter, claimed off waivers by Boston from Edmonton on Wednesday, was a healthy scratch. ... Bjugstad has five points the past six games for the Panthers.