San Francisco announced the pact Wednesday night. Staley, 34, started 16 games last season. The six-time Pro Bowl selection has 174 starts for the 49ers since being selected with the No. 28 overall pick in the 2007 NFL Draft.
Staley rated as the No. 6 tackle in the NFL last season, according to Pro Football Focus. His new deal keeps him with the NFC West franchise through 2021. Staley is set to make $10.9 million in 2019.
He said his negotiations with the 49ers were "easy," but he was "really nervous." The 6-foot-5, 315-pound offensive lineman said he started crying after signing the extension.
"It was a big deal for me," Staley told reporters. "It's something I was very proud of. The opportunity to finish my career in one spot was one of my goals when I came in ... just to play with one franchise and make a career out of this."
San Francisco had its final day of OTAs on Thursday and returns for minicamp Tuesday.