Niemi, 34, was set to become an unrestricted free agent on July 1.
Last season, Niemi posted a 7-5-4 record, 2.46 goals-against average, .929 save percentage and one shutout in 19 games with the Canadiens. In 24 games with Montreal, Pittsburgh Penguins, and Florida Panthers in 2017-18, he compiled a 7-9-4 record, 3.12 goals-against average, and .911 save percentage.
In March, the Montreal chapter of the Professional Hockey Writers Association selected him as the Canadiens' 2017-18 nominee for the Masterton Trophy.
A native of Vantaa, Finland, Niemi has appeared in 447 NHL contests with the Chicago Blackhawks, San Jose Sharks, Dallas Stars, Penguins, Panthers, and Canadiens. He holds a 234-134-55 record, 2.52 goals-against average, and .913 save percentage to go along with 36 shutouts.
Niemi won the Stanley Cup with the Blackhawks in 2010.
Never drafted, Niemi signed as a free agent with Chicago ahead of the 2008-09 season. He joined the Canadiens when he was claimed off waivers from Florida on November 14.