PHILADELPHIA -- Chase Utley is staying in those red pinstripes.

Utley and the Phillies agreed to a contract that could keep the five-time All-Star second baseman in Philadelphia through at least the 2015 season, sources confirmed to ESPN on Wednesday.

The deal is worth $27 million for two seasons with multiple vesting options, sources told ESPN.com's Jayson Stark.

Utley has battled knee injuries in the past, but that hasn't been a problem this year. He missed a month with an oblique injury.

"We'd like to keep the man in our pinstripes," general manager Ruben Amaro Jr. said last week.

Before the All-Star break, Utley said: "I've never envisioned wearing another team's uniform."

Utley, who turns 35 on Dec. 17, would've been a free agent after the season. He's in the last year of an $85 million contract signed in January 2007.

Utley wasn't in the starting lineup against the Chicago Cubs on Wednesday night, but drove in the tying run with a pinch single in the seventh inning. Utley then knocked over catcher Dioner Navarro in a violent collision trying to score from second base on a single. Navarro held onto the ball and Utley was out. Navarro was carted off the field with a left leg injury.

Utley was hitting .277 with 15 homers and 43 RBIs in 84 games entering Wednesday. He hasn't played more than 115 games in a season since 2009 because of chronic knee problems.

Between 2005-09, Utley averaged .301, 29 homers and 101 RBIs. He hasn't hit more than 16 homers or driven in more than 65 runs since 2010.

Still, retaining Utley was a priority for Amaro. The gritty, hard-nosed Utley is one of the all-time fan favorites in Philadelphia, revered by fans who love tough players. He's a leader on a team that has struggled the past two years after winning five straight division titles and the 2008 World Series.

Veteran catcher Carlos Ruiz and former ace Roy Halladay also are in the final years of their contracts, and Amaro has stated interest in keeping both.

More From 97.3 ESPN