The Hurricanes also received the rights to Brown University defenseman Dennis Robertson in the trade announced during the Maple Leafs' game against Detroit in the Winter Classic.
The 30-year-old Gleason was the Hurricanes' most physical defenseman and one of the longest-tenured players on the team. Only captain Eric Staal and 2006 Conn Smythe Trophy-winning goalie Cam Ward have been with the franchise longer.
The 33-year-old Liles had 15 hits and averaged 17 minutes of ice time in six games this season with the Maple Leafs. He was scratched from the Winter Classic.
"John Liles was an excellent person for us and an excellent player," Toronto coach Randy Carlyle said. "He backed what we were trying to do and he was one of our leaders and it was a hard thing to do. An unfortunate situation where we couldn't get him ice time. Young guys like Morgan Rielly pushed him out the door. It was an unfortunate situation."
Carolina general manager Jim Rutherford says Liles is a puck-mover who "can make a difference offensively" from the blue line.
The Hurricanes acquired Gleason in a trade with Los Angeles in September 2006, three months after they won their only Stanley Cup. He missed 21 games this season due to injury, including the first 10 with a concussion, and had one assist while playing at a minus-7 rating with 10 penalty minutes.
Gleason played in 491 career games with the Hurricanes -- the third-highest total of any defenseman since the club moved from Hartford in 1997 -- and his 495 penalty minutes are the most of any Carolina defenseman since the move.
He was a healthy scratch for Tuesday night's overtime win against Montreal that snapped a five-game losing streak. The Hurricanes are sixth in the Metropolitan Division, 20 points behind division leader Pittsburgh and three behind the New York Rangers.
Gleason played for the silver-medal-winning United States team at the 2010 Winter Olympics, and twice in the past three years his teammates selected him as the club's Steve Chiasson Award winner for determination and dedication.
He's under contract through the 2015-16 season, having signed a four-year extension in July 2012 that will pay him $4.5 million both this season and next, and $3.5 million in the final year of the deal.
Liles also is under contract through 2015-16 at an average of $3.875 million per year.
The Hurricanes also picked up the rights to the 22-year-old Robertson, who has three goals and five assists during his senior season at Brown.