Khudobin made 25 saves for the Bruins (3-2-0), who had won their previous two games.
After outshooting Boston 13-6 during a scoreless first period, the Canadiens carried their momentum into the second and dominated possession. Montreal scored first when Gallagher beat Khudobin with a one-timer from the top of the right circle at 11:41.
Montreal took a 2-0 lead when John-Michael Liles missed the puck on a pinch down the left wall and Alexander Radulov led a 2-on-1, which was capped by Danault's first goal of the season at 17:44.
Bruins coach Claude Julien was not pleased by the second period.
"I thought the first period, I thought we played well. The only thing for me in the first period is the amount of shots that missed the net and the amount of shots that were blocked," Julien said. "But the second period came back to haunt us. We were flat coming out, we didn't make good outlet passes and we spent way too much time in our own end. And because of that, [we] gave them some momentum. And then by the end of it, we cheated ourselves a little bit and pucks ended up in the back of our net."
The Bruins got within 2-1 after Noel Acciari cleared the puck out of the defensive zone and sent Dominic Moore on a 2-on-1 with Tim Schaller. Moore took Schaller's return pass and beat Price to the stick side at 5:34.