Smith will receive a one-year deal worth around $5 million, the source said.
San Francisco picked Colin Kaepernick in the second round out of Nevada in April's draft, but Smith had been expected to return as the 49ers' starting quarterback.
Despite being a free agent, the 27-year-old Smith organized the 49ers' player workouts during the lockout.
The top pick in 2005 said he made the decision to return to the 49ers after speaking with new coach Jim Harbaugh and, in part, because he wants to prove he wasn't a Bay Area bust.
Smith passed for 2,370 yards and 14 touchdowns in 11 games and 10 starts last season, but he also threw 10 interceptions and was sacked 25 times. The 49ers finished 6-10 after a surprising 0-5 start and haven't had a winning season or reached the playoffs since 2002.
Information from The Associated Press was used in this report.