Artturi Lehkonen, Andrew Shaw, Paul Byron, Max Domi and Tomas Tatar, into the empty net, also scored for the Canadiens (40-28-7), who have produced 14 goals on their current win streak. Domi and Tatar also had two assists each.
Making his seventh start in a row, goalie Carey Price made 23 saves on 27 shots.
Sam Reinhart, Alexander Nylander, Marco Scandella and Jack Eichel scored for the Sabres (31-34-9), who were officially eliminated from playoff contention. Carter Hutton stopped 37-of-43 shots.
Montreal increased its lead to three points over the idle Columbus Blue Jackets for the second wild-card spot in the Eastern Conference. Columbus has a game in hand.
The Canadiens remain two points behind the Carolina Hurricanes for the first wild-card spot. The Hurricanes, who have a game in hand on Montreal, beat Minnesota 5-1 on Saturday night. Montreal plays Carolina on Sunday.
With the game tied at 3-3 in the second period, Byron gave Montreal the lead at 18:03 on a 2-on-1 with Jordan Weal, whose shot was saved by Hutton before bouncing off Byron’s skate and in.
Domi sealed it with a power-play goal with 4:30 remaining in the encounter. Tatar, playing his 500th NHL game, scored an empty-netter with 2:13 to go.
The Sabres have one win in their past 10 games (1-8-1).
Reinhart got the high-scoring affair going when he went five-hole on Price at 12:26 of the first period.
The teams combined for six goals in a back-and-forth second.
Montreal tied it up 5:09 into the middle frame when Lehkonen took a feed from Shaw and scored while crashing into the net. Lehkonen only had one point in his previous 22 games.
Domi earned his 200th NHL point on the goal with a stylish spin-o-rama pass to Shaw.
Alone in the slot, Gallagher gave the Canadiens their first lead of the night at 9:12 after a remarkable one-handed pass from a sprawled-out Phillip Danault behind the net — a career-high 32nd goal this season for Gallagher.