BOSTON (AP) James Loney knows it always feels better having a lucky hit at the right time.
Asdrubal Cabrera had a game-tying RBI double and then scored on Loney's bloop single in the eighth inning, and the Tampa Bay Rays avoided a three-game sweep with a 4-3 comeback victory over the Boston Red Sox on Sunday.
''That's the best - like breaking your bat when you get a hit,'' Loney said. ''Through the course of the year you hit balls hard and they don't fall. You always want to take the ones that do fall.''
Loney's hit kept the Rays from falling to their fourth straight loss.
''A good win,'' said manager Kevin Cash, who agreed that some victories feel better because of how they happen.
They left the bases loaded in the seventh before coming up with the go-ahead rally.
Brandon Guyer opened the game with a homer for the Rays, who had lost 13 of their last 16 road games.
David Ortiz had an RBI for Boston, passing Hall of Famer Andre Dawson for 37th place with his 1,592nd RBI.
The Red Sox were looking for their first sweep of a series of three or more games since early June.
Steve Geltz (2-4) got the victory, retiring the only batter he faced. Brad Boxberger, the fourth reliever, struck out the final three batters for his 26th save.
The Red Sox wasted a solid start by Wade Miley, who held the Rays to two runs over 6 2-3 innings.
Trailing 3-2, Evan Longoria opened the eighth with a double off the Green Monster against Junichi Tazawa (2-4). One out later, Cabrera hit his ground-rule double over the head of right fielder Rusney Castillo. Loney followed with a bloop hit to center.
''It probably wasn't a bad pitch, but I still take responsibility,'' Tazawa said about Loney's hit through a translator. ''I did give up the lead so I'll prepare and I'll do my best for my next outing.''
Miley gave up five hits, striking out four and walking one in his season-high 120-pitch effort before being lifted after Kevin Kiermaier's two-out triple in the seventh.
''I made some good pitches in some situations we needed to make them in,'' Miley said.
Robbie Ross Jr. relieved and hit the first batter, walked the second, but struck out Joey Butler swinging on an inside cutter.
Jake Odorizzi, making his fifth start since a month on the disabled list with a strained left oblique, gave up three runs in six innings.
''I thought I did a pretty good job of managing my way through it to be honest with you,'' he said.
The Red Sox scored twice in the first to move ahead 2-1. Hanley Ramirez had an RBI double and scored on Mike Napoli's single.
They made it 3-1 on Ortiz's RBI double after Xander Bogaerts was hit by a pitch.
Tampa Bay sliced it to one on Loney's two-out RBI double into the right-field corner.
Guyer homered on the fifth pitch, hitting a shot that caromed off a billboard above the Monster seats.
Rays: Placed OF Steven Souza Jr. on the 15-day DL after he broke his left hand getting hit by a fastball from Joe Kelly on Saturday. Cash said he's expected to miss 4 to 6 weeks.
Red Sox: Placed struggling RHP Rick Porcello on the 15-day DL with soreness in his right triceps. ... 3B Pablo Sandoval was out for the third straight game because of a bruised left forearm after getting hit with a pitch Thursday before striking out pinch-hitting in the ninth. ... Manager John Farrell said OF Mookie Betts, on the seven-day concussion DL, is not expected to travel to New York for the club's upcoming series against the Yankees.
GOOD HE'S NOT AN INFIELDER
Rays RHP Chris Archer missed two ground balls in front of the dugout in one inning.
He took some razzing from his teammates.
''Yeah,'' he said of the teasing. ''Typical one is: `Ugly Finder.'''
Ramirez's bat flew into the stands about 20 rows behind the Rays' on-deck circle, but no one was injured. He had a security guard give another bat to a fan after getting back the one he was using.
Rays: RHP Nathan Karns (6-5) was flip-flopped with Odorizzi and is scheduled to open the three-game series against LHP Jose Quintana (6-9) when they play at the Chicago White Sox on Monday. He's made 15 starts giving up two or fewer runs, which entered Sunday tied for the AL's most.
Red Sox: Off Monday. Farrell said after the game that LHP Henry Owens would make his first major league start in Tuesday's series opener against Masahiro Tanaka (7-4) at Yankee Stadium.