SANTA CLARA, Calif. -- NaVorro Bowman had to tell someone about his hefty new contract before it became public. And there was pal Patrick Willis first thing Tuesday before they began their morning workout.

"He was excited as soon as I told him, when I wasn't supposed to," Bowman said about Willis, the godfather of Bowman's twin girls born earlier this year. "I couldn't keep it from him. I think he has lot to do with this, helping me out."

The 49ers' inside linebacker pair of Bowman and Willis will be lining up together on San Francisco's talented defense well into the future if all goes as planned.

On Tuesday, Bowman reached agreement on a five-year contract extension through the 2018 season -- a deal worth $45.25 million, with $25.5 million in guaranteed money.

"Any time you get a chance to get a deal done and it sounds great and everybody's comfortable with it, why not?" Bowman said. "It shows the trust the organization has in me."

With Bowman's new deal, it keeps one of the best and most feared linebacking tandems in the NFL together for the long haul -- as Willis is signed through 2016.

The 24-year-old Bowman, a third-round draft pick in 2010 out of Penn State, has 100 tackles, two sacks and an interception this season as a second-year starter for the NFC West-leading Niners (8-2-1). As a rookie, his 20 special-teams tackles ranked third in the NFL.

He was an All-Pro pick alongside Willis last season, and was selected as a Pro Bowl alternate.

"That's good, a young guy, a good guy, Pro Bowl, All-Pro guy to be around here another five years," cornerback Carlos Rogers said.

In addition to Bowman and Willis, the team's other two starting linebackers are signed at least for the next three seasons -- Ahmad Brooks through 2017 and Aldon Smith through 2015.

"We have a chance to do something really special, with all four linebackers being here for the next three years," Bowman said. "We can make a statement for ourselves and leave a legacy for this defense."