SANTA CLARA, Calif. — Veteran NFL players rarely get to leave the game on their own terms.

SANTA CLARA, Calif. — Veteran NFL players rarely get to leave the game on their own terms.

Justin Smith will do just that after signing a two-year contract extension Wednesday that keeps him in a 49ers uniform through the 2015 season. Smith, 33, recently parted ways with Creative Artists Agency and negotiated the extension himself.

It was simple, he said.

"They wanted me to be here and I wanted to be here," said the defensive end, who was approached recently by general manager Trent Baalke. "So it makes it easy."

Smith's status as the 49ers' indispensable man on defense was solidified last season when he tore his triceps tendon midway through a Week 15 game at New England. It was his first major injury in 12 NFL seasons, and the 49ers defense immediately felt its impact.

They narrowly hung on to beat the Patriots in that game and were pounded by the Seahawks the following week, giving up 176 rushing yards in a 42-13 loss.

Smith returned for the playoffs but was not at full strength. He had surgery immediately following the Super Bowl in February, and Wednesday he reported he was nearly 100 percent recovered.

Asked how much he can bench press, Smith said "over four plates," which is more than 400 pounds.

"I've got another six weeks to go," Smith said of his rehabilitation. "It's going good. I mean, I've never been injured like that. So I didn't know anything with the rehab process what to expect. What coming out of that surgery would be like, and it's all been really good."

A year ago, Smith said he didn't want to be the type of gray-bearded veteran who spends the twilight of his career playing only a handful of snaps. He said there was language built into the contract that allows both sides to cut ties if he is no longer the cog in the 49ers' defensive line as he's been since San Francisco acquired him as a free agent in 2008.

"That's not going to happen," he said. "I've said that, I meant that — I won't be the guy that's around for 10 snaps, 20 snaps. It's either, I'm going or I'm not going. If it's time to get my (butt) out of here, I'm going."

The 49ers signed Smith to a six-year, $45 million contract in 2008 after he had spent his first seven seasons with the Cincinnati Bengals. He is arguably the best free-agent acquisition in franchise history having gone to the Pro Bowl the previous four seasons and leading the way to the NFC Championship game in 2011.

The 49ers drafted two defensive linemen, Tank Carradine and Quinton Dial, in April. Carradine was a high, second-round pick and ostensibly was brought in to play defensive end in the future. Still, Smith said he never took that as a signal that the 49ers wanted to replace him.

"It's the NFL. You're always bringing in people, you're always bringing in competition," he said. "Coach (Jim) Harbaugh tells you first day, 'There's only so many seats. You guys are fighting for them. Good luck.' That's the way the National Football League is. You know that coming in. You know that going out."