The teams combined for 27 hits, a career-high four of them by Sanchez. Chris Coghlan reached base six times for the Marlins and scored four runs.
Florida defeated the Rays for just the third time in their last 15 meetings, producing nine runs during the third and fourth innings to take a 10-0 lead.
Sanchez hit a three-run home run as part of a four-run fourth and he had a solo shot in the seventh. Florida took charge with five runs in the third, two of them coming in on a Cody Ross single and two more on a Michael Stanton triple.
Anibal Sanchez (6-3) survived seven innings to get the win. He gave up four runs on seven hits.
Florida won its second in a row after beginning a road trip with four straight losses.
James Shields (5-5) allowed 10 runs on nine hits in 3 1/3 innings to take the loss.
Florida had a 14-3 lead going into the bottom of the seventh before the Rays put on a late rush. Tampa Bay scored four times in the eighth, getting a two-run single by Hank Blalock in the inning.
Celebrity Breakups and divorces of 2014 [PHOTOS]