The 26-year-old will count $4.15 million against the salary cap in each of the next two seasons.
The agreement Sunday came after Bernier and the Leafs went to team-elected salary arbitration but before the arbitrator could hand down a ruling.
Bernier, a native of Laval, Quebec, had a 2.87 goals-against average and .912 save percentage this past season for the Leafs.
In 175 NHL games with the Los Angeles Kings and Leafs, Bernier is 76-67-20 with a 2.63 GAA and .916 save percentage.
Signing Bernier was the final piece of essential business this offseason for Toronto, which also hired Mike Babcock as coach and Lou Lamoriello as general manager, traded Phil Kessel and signed a handful of unrestricted free agents.