The 49ers have signed defensive tackle Justin Smith to a two-year contract extension through 2015.