BOSTON — Evan Longoria's 20th home run put him in exclusive company.
Longoria joined Eddie Mathews, Chipper Jones and Scott Rolen as the only third baseman to hit 20 homers in seven of their first eight years in the majors.
"It's pretty cool," Longoria said. "It's one of those things where I'll just be able to look back in my career and tell my kids about it, and I just reflect about it when I get a chance to. The names are awesome to be in that group."
The Rays took three of four from the last-place Red Sox. Tampa Bay is fourth in the AL East, 2 1-2 games ahead of Boston.
Longoria also had a double and single.
"Let's just keep him hitting," Tampa Bay manager Kevin Cash said. "We've said it all year long. When he's hitting, that's what shapes our lineup."
Kevin Kiermaier also hit a solo homer for the Rays, who have won five of their last seven games.
Boston's David Ortiz hit his 36th homer — a two-run shot — and increased his RBI total to 101, reaching the century mark for the ninth season with the Red Sox to tie Hall of Famer Ted Williams for most in club history.
Big Papi also set a club record for most seasons with 35-or-more homers and 100 RBIs with his sixth. Manny Ramirez and Jimmie Foxx each had five.
Erasmo Ramirez (11-6) gave up two runs on four hits, striking out six without walking a batter. Brad Boxberger worked the ninth for his 38th save.
Trailing 2-0, Tampa Bay rallied against Wade Miley (11-11). Longoria homered deep into left-center over the Green Monster. Asdrubal Cabrera and Steven Souza Jr. had consecutive RBI doubles.
"It was the middle of their lineup that did most of the damage," Boston interim manager Torey Lovullo said.
Kiermaier homered into the right field seats leading off the seventh.
Miley allowed four runs on eight hits in 6 1-3 innings.
"I just didn't execute pitches," Miley said. "I was in situations where I was in pretty good counts and just didn't make a pitch I needed to make. Obviously they made me pay for it."
Boston moved ahead 2-0 in the first when Ortiz homered into the first row of Monster seats.
Red Sox: Lovullo said 3B Pablo Sandoval has pneumonia. He'll be re-evaluated Saturday. Originally, the club said he had an upper respiratory infection. . Hanley Ramirez was shut down for the rest of the season with right shoulder inflammation.
Boxberger faced the Red Sox 11 times this season, holding them scoreless in every appearance while collecting six saves.
The Rays took the season series against Boston, 10-9.
Rays: RHP Jake Odorizzi (8-8) is set to open a three-game series Friday when Tampa Bay faces RHP R.A. Dickey (10-11) and the AL East-leading Blue Jays in Toronto.
Red Sox: LHP Rich Hill (1-0, 1.93 ERA) looks to continue his career revival Friday when Boston hosts RHP Kevin Gausman (3-6) and the Baltimore Orioles. Hill was pitching for the independent-league Long Island Ducks before Boston signed him to a minor league deal.