The deal, which starts with the 2018-19 season, includes a player option on the fourth year, league sources said.
Powell has steadily developed into one of the league's best young two-way guards. He is expected to play a significant role in Toronto's bid for an Eastern Conference championship.
Powell, the 46th overall pick in the 2015 NBA draft, could have become a restricted free agent in July.
Raptors president Masai Ujiri and Powell's agent, Thad Foucher of Wasserman Media Group, completed the deal Thursday.
Powell has averaged 7.3 points in two NBA seasons, including 8.4 points in 2016-17. In nine playoff games last season, Powell averaged 11.7 points and 44 percent on 3-point shooting.
Powell was eligible for the higher figure between 120 percent of his $1.4 million annual salary, or 120 percent of the average projected NBA salary this season. Miami recently agreed to a four-year, $42 million extension with Josh Richardson under the provision in the NBA's new collective bargaining agreement.