Williams, who turns 28 in August, is a depth addition at both guard and tackle for the Bills. He played in all 16 games for the Carolina Panthers last season, starting 12, after missing all but one game in 2018 because of a knee injury suffered in the opening game.
Buffalo re-signed left guard Quinton Spain to a three-year contract before free agency began last week and picked up the option on interior lineman Spencer Long. Adding Williams gives the Bills yet another offensive lineman with positional flexibility.
Before his injury in 2018, Williams had been in line for a big contract after a 2017 season in which he started 16 games for the Panthers at right tackle. Pro Football Focus gave the 2015 fourth-round pick out of Oklahoma a grade of 78.0 that ranked third among right tackles in the NFL.
The 6-foot-3, 330-pound tackle appeared in 56 games with 41 starts in his five seasons with the Panthers.
ESPN's Marcel Louis-Jacques and David Newton contributed to this report.