The team did not disclose terms, but sources told ESPN NFL Insider Adam Schefter it is a six-year, $39 million deal with $17 million guaranteed.
Williams will become one of the NFL's top-paid defensive lineman, as the extension is similar to the five-year, $40 million deal New England Patriots defensive tackle Vince Wilfork reached in March 2010, a person familiar with the contract told The Associated Press. Williams had two years left on his contract, with the extension locking him up through the 2016 season.
He'll average between $7.5 million and $8.2 million a year depending on if he meets all the contract incentives, the person told The AP.
"He's real happy to remain a Bill," Williams' agent Albert Elias said. "Three contracts in five years shows their commitment to winning, and that's exciting."
Williams has been a starter since his rookie season in 2006, when the Bills drafted him in the fifth round out of LSU. He's been the Bills' most consistent defensive player, and is coming off a season in which he had a team-leading and career-best 5½ sacks.
That was enough to earn Williams his first Pro Bowl appearance even though he was a member of the NFL's worst run defense. Selected as a first alternate, he was added to the AFC team to replace injured Oakland Raiders lineman Richard Seymour.
Overall, Williams has 13½ sacks in 78 games.
Williams will get additional support this season in being part of a revamped defense that includes the addition of defensive lineman Marcell Dareus, who was drafted with the No. 3 pick in April.
Williams and the Bills first opened negotiations about two weeks ago.
The agreement comes at a time when the Bills are being criticized for being cost-conscious. According to NFL.com, the Bills had a payroll of a little more than $96 million two weeks ago, which put them more than $26 million below their adjusted salary cap number for this season. According to the report, only four teams had more space below their adjusted cap.
And that was after the team was questioned for trading its top offensive threat, seven-year veteran receiver Lee Evans to Baltimore in exchange for a fourth-round draft pick.
The Bills aren't expected to be done restructuring their payroll, as they have several key players entering the final year of their current contracts.
Starting running back Fred Jackson is also unhappy with his contract. He has two years left on it, but believes he's being underpaid after leading the team in rushing in each of the past two seasons.
Information from The Associated Press contributed to this report.