The new pact starts in 2015 and includes a fifth-year club option for $12.5 million and a $2 million buyout.

If traded, Gardner would receive $1 million.

"It shows the level of confidence, belief and trust, and the type of player and person he is," Yankees general manager Brian Cashman said. "We're excited to know that he's going to be a part of this team going forward. We're a better team with Gardy on it, that's the bottom line. This is a good day for him, and we believe it makes the future for us better."

Gardner has a $5.6 million, one-year contract for this season. He would have been eligible for free agency after the 2014 season.

"Free agency is something that, it kind of intrigued me, but it also kind of scared me," Gardner said. "I've never been anywhere else. I love it here. I love putting on the pinstripes everyday."

Cashman said talks about the contract started at the winter meetings in December.

The Yankees are moving Gardner to left field this year after the signing of free agent center fielder Jacoby Ellsbury to a $153 million, seven-year contract in December.

Gardner did have questions in his mind about his Yankees' future after the Ellsbury signing.

"When they signed Jacoby, your name gets thrown out in the trade rumors and all that," Gardner said. "It's kind of annoying, really. I didn't want to get traded. I don't want to go anywhere else, and I let them know that."

The 30-year-old Gardner hit .273 last year with eight home runs, 52 RBI and 24 stolen bases.

"I like what he brings," Cashman said. "The speed dynamic, the defense, and I think the offense is there, as well."

Also, the Yankees agreed to a minor-league contract with injured closer Andrew Bailey, who was with Boston last year and is coming back from right shoulder surgery last July.

Cashman said the right-hander might be able to join the team in August or September.

"When he is healthy, he's an exceptional reliever," Cashman said. "He's coming off of a shoulder surgery, so we're taking a flier. A low risk. If we can get a reward out of it, great. If not, it's one of those nothing ventured, nothing gained."