The Bills also re-signed longtime defensive tackle Kyle Williams to a one-year deal, the team announced Tuesday. His one-year deal is worth up to $6 million with $5 million fully guaranteed, a source confirmed to ESPN. NFL Network first reported the compensation.
Williams, 34, will enter his 13th season in Buffalo after being selected in the fifth round of the 2006 draft.
"When it comes down to it, as eloquently as I can put it, I haven't exhausted myself in my pursuit of what my dream is of playing this game, playing for this organization and chasing being a champion," he said Tuesday. "Buffalo is home. It's where I want to be. It's where I want to win. I couldn't be more excited."
Lotulelei, the 14th overall selection in the 2013 draft, spent most of the past five seasons being overshadowed by Panthers teammate Kawann Short, who made the Pro Bowl in 2015.
Defensive tackle was one of the Bills' biggest needs entering free agency, with only three players -- Adolphus Washington, Marquavius Lewis and Rickey Hatley -- under contract at the position for next season.
The Bills allowed a league-high 18 rushing touchdowns and an AFC-worst 1,487 rush yards after trading Marcell Dareus in Week 8 last season, according to ESPN Stats & Information research. Of those yards, 1,105 were inside the tackles, and opponents' 4.8 yards per rush inside the tackles was tied for worst in the NFL.
Williams is the Bills' all-time leader among defensive tackles in sacks, with 43.5. He has been named to five Pro Bowls and started 162 of the 167 games in Buffalo, where he frequently was voted as a team captain.
After the Bills' wild-card playoff loss to the Jacksonville Jaguars, Williams said he would take time this offseason before deciding his playing future.
Lotulelei played under Bills coach Sean McDermott from 2013 through 2016 when McDermott was the Panthers' defensive coordinator.
The 28-year-old Lotulelei, known primarily as a run-stuffer who can take up multiple blockers, had 11.5 sacks in five seasons. Meanwhile, Short, a 2013 second-round pick, accumulated 24.5 sacks over the past three seasons and parlayed that into a five-year, $80.5 million extension before last season.
Former general manager Dave Gettleman, who was fired in July, picked defensive tackle Vernon Butler in the first round of the 2016 draft, knowing it would be tough to give big contracts to both Short and Lotulelei.
O'Leary caught a career-high 22 passes for 322 yards and two touchdowns last season in 15 games, including five starts. Yarbrough appeared in all 16 games, making six starts and recording 34 tackles and one sack.
ESPN's David Newton and Mike Rodak contributed to this report.