Talks about extending the contract, which previously ran to 2024, began last year.
But there were concerns about the Circuit Gilles Villeneuve's chances of staying on the F1 calendar as it will miss a 2017 deadline for upgrading its pit facilities.
Organisers have now completed a deal with F1's new owner Liberty Media, and as part of the agreement the city of Montreal authorities have committed to providing funds to upgrade the garage building - which has been in place since 1988.
Canadian Grand Prix
Mercedes win 'a great blow' to Ferrari - Hamilton
11/06/2017 AT 21:24
"It's a long contract and one which gives us time to plan and to work on improving the facilities," promoter Francois Dumontier told Autosport.
"With the new garages arriving in 2019, extending the contract was important.
"We will start work with the city, who own the circuit, to work on the plans and drawings and plan a construction schedule for the new garages.

Sebastian Vettel (Ferrari), Lewis Hamilton (Mercedes) - GP of Canada 2016

Image credit: AFP

"Then between the 2018 and '19 races, the construction will take place.
"It will be a completely new building, with the current one removed."
Dumontier added that Liberty Media had been clear that "Montreal is important to the championship" during their discussions.
Canadian Grand Prix
Canadian Grand Prix: Alonso angry, Hamilton cruising - and the return of the shoey
11/06/2017 AT 20:31
Canadian Grand Prix
Hamilton wins in Montreal as Vettel finishes fourth after poor start
11/06/2017 AT 19:36