BOSTON — 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.
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.
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.
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.
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.