Leivo, 24, could have become a restricted free agent July 1, 2018. He has an NHL salary-cap charge of $612,500 this season, according to CapFriendly.com.
"We were just talking, and they just wanted me to have the security so I could play a game and not have to worry about the next year," Leivo told Sportsnet on Saturday. "It feels great. I get to focus now on just playing."
He has one assist, a plus-1 rating and seven shots on goal in five NHL games this season.
"He's a player that we like," Toronto coach Mike Babcock said. "So if you like a guy, why wouldn't you [re-sign him]?"
Selected by the Maple Leafs in the third round (No. 86) of the 2011 NHL Draft, Leivo has 19 points (nine goals, 10 assists) in 46 games in five seasons.
"The atmosphere, the fans, the city's great. Being from Richmond Hill and Innisfil, it's really close to home, so it's an awesome feeling, and I'm happy to have another year," Leivo said. "It's kind of a fun room right now."