Quarterback Alex Smith has agreed to a new three-year deal to stay with the San Francisco 49ers, sources confirmed to ESPN.com senior NFL writer John Clayton.

The Associated Press, citing an unnamed source, reported Wednesday that Smith's contract will pay him $8 million per season with $16.5 million guaranteed. Smith's new deal can pay him up to $33 million if he reaches all of the incentives in the contract.

"Oh, I'm excited," tight end Vernon Davis told The Associated Press in a text message Tuesday night. "I'm glad. Alex deserves all good things that come his way."

Smith's future in the Bay Area came into question after the 49ers were revealed as a late entrant in the Peyton Manning sweepstakes. Manning signed a 5-year, $96 million deal with the Denver Broncos on Tuesday.

Smith, a free agent, visited with the Miami Dolphins over the weekend after the 49ers met with and worked out Manning and put the former Colts quarterback through a physical exam.

49ers CEO Jed York told CSNBayArea.com on Monday they would like Smith to return, but the decision was up to Smith.

"We have a contract on the table and it's up to him," York told the website. "We'd like for him (Alex Smith) to be here, and we'll see where it goes."

According to the Sacramento Bee, coach Jim Harbaugh met with Smith for an hour Monday in an effort to get the quarterback to return to San Francisco for the 2012 season.

Smith had a breakthrough season last year, helping San Francisco reach the NFC Championship Game.

"Welcome Back #AlexSmith. Let's get the train rolling now," tweeted 49ers defensive lineman Ricky Jean Francois.

Both sides made it clear after the Niners' 20-17 overtime loss to the eventual Super Bowl champion New York Giants in the NFC title game they planned to work out a new deal.

It just took a little while longer than expected after Manning briefly entered the picture.

While Smith told the South Florida Sun-Sentinel on Sunday he was surprised Manning became a free agent, he said he understood the business side of the NFL.

"It's a very strong relationship," Harbaugh told reporters while leaving team headquarters Tuesday, noting nothing had changed in Smith being "our guy." He declined to discuss negotiations.