Boston reduced its magic number for clinching the American League East title to eight and the Rays saw their advantage reduced in the crowded wild-card race.
Tampa Bay is out front in the chase for the league's second wild-card spot but its lead is only one game over the New York Yankees, 1 1/2 games over both Baltimore and Cleveland and two games over Kansas City.
The Rays overcame a two-run deficit with runs in the seventh and eighth innings but Boston broke things open in the 10th against Joel Peralta (2-7).
Dustin Pedroia walked to open the inning and moved to second on a sacrifice by Shane Victorino. David Ortiz was walked intentionally and Roberto Hernandez was called on to replace Peralta, becoming the eighth Tampa Bay pitcher of the game.
Mike Napoli walked, loading the bases, and Carp hit the first pitch he saw from Hernandez out to center for his ninth home run of the year.
That gave the win to Koji Uehara (4-0), who struck out two while working the bottom of the ninth.
Swim Week Miami Beach 2014 [PHOTOS]