BOSTON (AP) -- Alex Rodriguez doubled to break a sixth-inning tie, move into the top 25 on baseball's career hits list and help the New York Yankees beat the Boston Red Sox 8-6 on Sunday.

The win gave the Yankees the edge in the three-game series and moved them 6 1/2 games in front of last-place Boston in the bunched-up AL East. New York leads the division by 3 1/2 games heading into the All-Star break.

Yankees prospect Rob Refsnyder had his first career hit with a single in the seventh inning and then added a two-run homer in the ninth to make it 8-4. The Red Sox cut it to 8-6 in the ninth thanks to two New York errors, but Andrew Miller got Shane Victorino on a pop-up to shallow left to end it.

Brian McCann also had two hits, including a two-run homer. Nathan Eovaldi (9-2) gave up three runs on seven hits, striking out four in five innings to win his fourth straight decision.

Xander Bogaerts, Hanley Ramirez and Alejandro De Aza each had two hits for Boston. The Red Sox, who trailed the Yankees by 10 games on June 20, had won 10 of 13.

Wade Miley (8-8) gave up the tying run on a fifth-inning balk and ran into more trouble in the sixth.

Gardner led off with a slow chopper to second base for an infield single, then Rodriguez lined a double to center to make it 4-3. That was hit No. 3,020, tying him with Rafael Palmeiro for 25th on baseball's all-time list.

One out later, Chris Young doubled to left to score Rodriguez and chase Miley.

Tommy Layne got McCann on a grounder, but Headley doubled to score Young and make it 6-3.

Boston cut the deficit to 6-4 in the bottom half when Ramirez doubled and scored. Justin Wilson replaced Adam Warren and, with two on, retired Ryan Hanigan and Mookie Betts to end the threat.

Miley allowed six runs on seven hits, striking out two in 5 1-3 innings to take his first loss at Fenway since May 2.

TRAINER'S ROOM

Yankees: Manager Joe Girardi said that RHP Ivan Nova, who missed the season's first 71 games coming off of Tommy John surgery, will get some extra rest during the break. After pitching Saturday, he isn't scheduled to start again until July 22.

Red Sox: DH David Ortiz got the day off because of an upper respiratory condition. Manager John Farrell said he would be given fluids. Farrell also said 2B Dustin Pedroia is expected to return Friday, when the team comes back after the All-Star break.

UP NEXT

Yankees: Begin a three-game series with the Seattle Mariners after the All-Star break.

Red Sox: Play four games in Anaheim against the Angels after the break.

© 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed. Learn more about our Privacy Policy and Terms of Use.

More From New Jersey 101.5 FM