The 49ers signed All-Pro defensive lineman Justin Smith to a two-year contract extension through the 2015 season, the 49ers announced Wednesday.

Smith signed a six-year, $45 million deal with the 49ers in 2008, and has been one of the most productive free agents in franchise history. Smith has been selected to four consecutive NFC Pro Bowl teams after playing his first seven seasons with the Cincinnati Bengals.

"Justin's All-Pro contributions on the field, as well as his leadership on and off the field, are integral to our success," 49ers general manager Trent Baalke said in a statement.

"Justin consistently sets a standard of excellence. This contract allows Justin to finish his career as a 49er." Smith is returning from a season in which he missed the final 2 1/2 regular-season games with a partially torn left triceps tendon. Smith returned for the playoffs.

Shortly after the 49ers' Super Bowl loss, Smith underwent surgery to repair the triceps. He is near 100 percent, and coach Jim Harbaugh recently said Smith was bench-pressing 350 pounds.

Last week, Smith said he was focused only on the upcoming season and he was taking his career year-by-year.

"You really can't forecast anything out past the year you're in," Smith said. "So I'm thinking about 2013, and 2013 only."

"At this point in my career, nothing's a given, nothing's a guarantee. They don't like old guys, anyway, for football. I'm going to enjoy this year and do the best I can this year and hopefully it's enough for us and the team and we get it done."