Gallagher scored his sixth of the season 9:08 into the third to break a 2-2 tie. Pacioretty cemented the win with his sixth goal—and second of the game—at 14:26. Gionta added an empty-net tally with 2:26 left.
Pacioretty also scored in the second period, and defenseman Alexei Emelin got Montreal on the board in the first period. Carey Price made 21 saves for his 11th win.
Frazer McLaren and Clarke MacArthur scored for Toronto (12-9), which had won three straight at home.
This victory was payback for the Canadiens (13-4-3), who were routed by the Maple Leafs 6-0 in Montreal on Feb. 9. Since then, the Canadiens have gone 7-0-2.
Montreal outshot Toronto 40-23 before a season-high Air Canada Centre crowd of 19,625.
Maple Leafs goalie Ben Scrivens made his eighth straight start and kept his club in the game, finishing with 35 saves.
There was bad blood between the longtime rivals, stemming from the previous meeting in Montreal in which an alleged biting incident involving Mikhail Grabovski and Pacioretty occurred.
While the teams played a physical game in the rematch, there were no major incidents this time.
The Canadiens had forward Michael Ryder in the lineup after reacquiring him from the Dallas Stars on Tuesday for Erik Cole.
Ryder didn't figure in the scoring but wore his usual No. 73 after rookie Gallagher gave it up to him. Ryder has worn No. 73 since breaking into the NHL in 2003. Gallagher wore No. 11.
Montreal controlled much of the first period, outshooting the Leafs 12-4, but McLaren opened the scoring with his second goal at 13:44.
Emelin tied it with his first at 16:56 before Toronto's Mike Brown received a major penalty for checking from behind and was ejected after he hit Josh Gorges in the final minute of the period.
Pacioretty put Montreal ahead on the power play at 4:17 of the second. Scrivens attempted to deflect P.K. Subban's point shot to the corner but it deflected in off Pacioretty for his fifth.
Toronto had a prime chance to tie it when Grabovski was awarded a penalty shot at 11:45 after he was hauled down by Emelin. But Grabovski couldn't beat Price to the stick side on the attempted deke.
MacArthur tied it at 15:47 with his fifth.
NOTES—This was the third of five meetings this season between the teams. ... James Reimer served as Scrivens' backup after being added to the active roster earlier Wednesday. Reimer had been out since sustaining a knee injury Feb. 11 against Philadelphia. G Jussi Rynnas was reassigned to the AHL's Toronto Marlies. Reimer is expected to start Thursday at the New York Islanders. ... With Rafael Diaz (concussion) out, Montreal D Tomas Kaberle suited up against his former team. ... Maple Leafs D Mark Fraser came into the game leading the NHL with a plus-14 rating.