The Bills also re-signed longtime defensive tackle Kyle Williams to a one-year deal, the team announced Tuesday.
Williams, 34, will enter his 13th season in Buffalo after being selected in the fifth round of the 2006 draft.
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.