It is a two-year, $20 million contract with a player option after this coming season, sources told Stein.
Dallas and Atlanta had been in the hunt for Deng, as was Phoenix, who jumped into the mix on Saturday, according to sources.
Deng is entering his 11th NBA season, having spent almost his entire career with the Chicago Bulls. He was traded from Chicago to Cleveland in January after years of trade rumors.
Sources close to the situation told ESPN.com's Marc Stein that the Heat on Sunday also came to two-year agreements to re-sign guard Mario Chalmers and center Chris Andersen, both are familiar faces from the Heat's run of four successive trips to the Finals. Chalmers' deal is said to be in the $8 million range while Andersen's is in the $10 million range, according to sources.
Chalmers took to Twitter to announce he was staying in Miami.
Proud to say I'm back wit the heat. Heat nation we still here- Mario Chalmers (@mchalmers15) July 13, 2014
Deng appeared in 40 games with the Cavaliers after the trade last season.
Deng has averaged 16.0 points per game in his career, after being chosen No. 7 overall from Duke in the 2004 draft.
The Associated Press contributed to this report.