The Niners announced Monday that they have agreed to terms on a two-year contract with the veteran wide receiver.
The team did not disclose financial terms, but a source told ESPN NFL Insider Ed Werder that Boldin agreed to a $12 million deal that includes $9 million in guaranteed money.
"We are pleased that Anquan has chosen to continue his career as a 49er," general manager Trent Baalke said in a statement released by the team. "He is a consummate professional whose love and respect for the game provide a tremendous example for all players.
"Anquan has been a very productive player throughout his career, and we look forward to his future contributions to our team and community."
Boldin announced Monday on his Twitter account that he reached a deal to stay with the team.
The 33-year-old also posted a statement titled "The Return To The Bay" on his foundation's website.
"49er fans, I wanted to be the first to tell you that I'm returning to San Francisco," Boldin said in the statement. "Looking forward to joining my teammates, coaching staff and fans to bring back another championship to the Bay Area. Let's go after our Quest For Six."
The 49ers acquired Boldin from the Baltimore Ravens last March for a sixth-round pick.
Boldin had a huge season for the Niners a year after helping the Ravens beat San Francisco in the Super Bowl. The three-time Pro Bowler had 85 catches for 1,179 yards and seven touchdowns.
He also helped fuel the 49ers' offense for the first 11 games while Michael Crabtree was out with a torn Achilles. Boldin was a leader of the team and respected by coaches and players.
ESPN NFL Insider Ed Werder and ESPN.com 49ers reporter Bill Williamson contributed to this report.