The deal is worth $82 million, agent Rich Paul told ESPN.com on Wednesday. The deal does not include player or team options, and all money is guaranteed.
It also ends a contract stalemate dating to July that caused Thompson to miss training camp and the preseason.
Thompson, 24, had been seeking a max contract of five years and $94 million or three years and $53 million. The Cavs had previously offered five years and $80 million.
While Thompson settled for less than the max, his deal is larger than many league officials thought he would get heading into the summer.
The contract completes the Cavs' goal of bringing back the core of the team that reached the Finals last season. It cost them heavily to do so -- the contracts for LeBron James, Kevin Love, Iman Shumpert, J.R. Smith and Thompson total more than $290 million in guaranteed money.
It will also come with a massive tax bill. Though the tax won't be calculated until the end of the season, and the Cavs have only 14 guaranteed contracts, they are now in line to pay in excess of $60 million in luxury tax, which would be the second highest on record.
Including salaries and tax, the Cavs are likely to spend more than $170 million on this season's roster, the second-highest number in league history behind the 2013-14 Brooklyn Nets. The Nets spent $197 million that season, including a record $90.5 million in tax.
The Cavs now have long-term deals locked up with Love, Thompson and young star Kyrie Irving, who is starting a five-year, $94 million extension he signed in 2014.
Thompson was quick to weigh in via social media in the wake of the agreement.
It's been a long summer of grinding and hard work but now it's back to The Land to take care of some... https://t.co/eD5MIBdX6W— Tristan Thompson (@RealTristan13) October 21, 2015
Negotiations between the team and Thompson dragged out for more than a year. Last fall, the Cavs offered Thompson a four-year deal worth $50 million, and Thompson turned it down.
Thompson, drafted by the Cavs fourth overall in 2011 out of Texas, averaged 8.5 points and 8.0 rebounds while coming off the bench last season. His considerable value to the Cavs was seen in the playoffs, in which he started 15 games in place of an injured Love. He averaged 9.6 points and 10.8 rebounds in the postseason, helping the Cavs reach the Finals, where they lost in six games to the Warriors.
Thompson is one of the league's best offensive rebounders and averaged 4.4 per game during the playoffs.