Quarterback Alex Smith and the San Francisco 49ers have agreed to terms on a three-year contract that will pay him $8 million per season with $16.5 million guaranteed, a person with knowledge of the negotiations said Wednesday.