The Vertical was first to report the deal Sunday.
Williams will make $6 million in 2017-18 and then will receive $5.5 million in the second and third years of the deal, sources told Begley.
The 6-foot-8 Williams got regular time in his second season in the league after the Suns shut down Tyson Chandler, averaging 17.6 points and 14.8 rebounds per 36 minutes in 2016-17.
The New York Knicks were also interested in signing Williams but the Suns were expected to match any offer, league sources told ESPN's Ian Begley.
The 24-year-old went undrafted out of the University of California Santa Barbara.
Williams was ranked No. 24 on the list of top available free agents this offseason compiled by ESPN's Kevin Pelton.