The deal keeps him in Montreal through 2026-27.
Gallagher, 28, had 22 goals and 43 points in 59 games this past season with Montreal. His 2020-21 cap hit is $3.75 million in the final year of his previous deal.
Gallagher has played his entire eight-season career with the Canadiens, who slected him in the fifth round of the 2010 NHL draft.
He has 173 goals and 334 points in 547 career regular-season games.