The Bills on Wednesday signed Anderson, their second significant free-agent splash in less than a week.
Anderson's agent told ESPNBoston.com's Mike Reiss the deal is for four years and a person familiar with the deal told The Associated Press it is potentially worth $27 million and includes $8 million guaranteed.
The sixth-year defensive end had 10 sacks with the New England Patriots last season.
"It really is a big deal for us and an exciting time," general manager Buddy Nix said. "We think this made us a lot better. This guy's about as productive as anybody around for the number of snaps he played."
Acquiring Anderson comes on the heels of last week's whopping move in which the Bills signed Williams to a six-year contract potentially worth $100 million, including $50 million guaranteed.
Earlier on Wednesday, the Bills also re-signed free-agent safety Bryan Scott. The nine-year versatile veteran, who also can play linebacker, returns for a sixth season in Buffalo.
Anderson's signing was the key move, coming a day after he arrived in Buffalo and had dinner with coaches and management at a downtown restaurant.
"Words can't express how I'm feeling," Anderson said. "I'm in a blessed situation right now. I'm going to try and help the Bills, and Bills Nation, and try to take it to a whole other level."
Selected in the fifth round of the 2006 draft by Chicago, Anderson spent four-plus seasons with the Bears before finishing the 2010 season playing with Williams in Houston.
Overall, he has 35½ sacks in 93 career games, including 21 starts.
After visiting several other teams since the start of free agency, Anderson said Williams played a role in recruiting him to sign with the Bills. Anderson was also impressed by how the Bills are building their defensive front.
"I've seen everything that they were doing, and I just want to be part of that," he said.
Anderson is expected to compete for a starting job with returning veterans Chris Kelsay and Dwan Edwards for the chance to play opposite Williams. The Bills are making the switch to a four-down-linemen, three-linebacker defense under newly promoted coordinator Dave Wannstedt.
Buffalo's already set in the middle with tackles Kyle Williams and Marcell Dareus. Kyle Williams is expected to be fully recovered after having surgery in November to repair a nagging foot injury. And Dareus is coming off a promising rookie season, during which the first-round draft pick led Buffalo with 5½ sacks.
And don't forget linebacker Shawne Merriman, who has one year left on his contract and is attempting to rebound after having surgery to repair both a shoulder injury and a nagging Achilles tendon.
Coach Chan Gailey said it's too early to determine Anderson's role.
"Don't put us in a corner yet about where everyone's going to be," Gailey said. "We've got some good football players, and we're going to make sure the best football players get on the field."
Add it up, and the Bills have one of the NFL's highest-priced defensive fronts by having committed more than $186 million in new salary over the past year. That includes Kyle Williams signing a six-year, $39 million contract extension in August, and Dareus' four-year, $20.4 million rookie contract.
And it's a line that now stands to be the strength of what had been a young, patchwork defense last year in taking the brunt of the blame for a 6-10 finish, which included the Bills losing eight of their final nine games.
Buffalo ranked 30th in the NFL in allowing 434 points and 26th in allowing a franchise-worst 5,938 yards. They also managed 29 sacks -- 10 coming in one game -- to finish in a four-way tie for 27th.
Scott's decision to re-sign with Buffalo did not come as a surprise after the Bills previously indicated they would like him back. Listed at 6-foot-1 and 220 pounds, Scott had two interceptions, one sack and recovered a fumble for a touchdown in 16 games, including seven starts, last season.
Selected by Atlanta in the second-round of the 2003 draft, the Penn State product spent his first three seasons with the Falcons and also played a year in New Orleans before signing with Buffalo in 2007.
Information from The Associated Press was used in this report.