The San Francisco 49ers have signed nose tackle Ian Williams to a two-year contract extension.