Niemann (9-3) earned the win after allowing four runs on eight hits while walking a pair and fanning four for Tampa Bay, which won its franchise-record 17th game during the month of July. Rafael Soriano retired the side in order in the ninth to secure the win and earn his 28th save.
Eddie Bonine (4-1) took the loss after lasting 3 1/3 innings in his first start of the season, during which he allowed five runs on eight hits and a walk for the Tigers, who have fallen in five of their last six games.
Rhymes started the game with a single and scored when Damon followed with a double to left-center field. Jeff Larish then picked up his first RBI of the season when he singled in Damon to make it 2-0 Detroit.
Damon drilled a line drive solo shot to right with two outs in the third to restore the Tigers two-run edge.
Tampa again answered in its half of the frame with Pena's RBI single and Willy Aybar's run-producing fielder's choice grounder.
Jason Bartlett's run-scoring hit and Carl Crawford's RBI ground out in the fourth put the home side in the lead for good.
The Rays put two runners on with nobody out in the home fifth but could not score after a botched squeeze bunt attempt. The mistake was magnified when Miguel Cabrera blasted a solo shot to left with one out in the sixth to trim the lead to one.
Grant Balfour took over in the seventh and ran into some trouble after a double and walk put two runners on for Larish, who struck out. The Rays then intentionally walked Cabrera and avoided any damage after Brennan Boesch flied out to end the inning.
Joaquin Benoit worked a scoreless eighth top of the eight before Longoria belted a two-out, two-run home run to left off Ryan Perry in the bottom of the frame to give the Rays some insurance heading into the ninth.
The Tigers announced the acquisition of infielder Jhonny Peralta from the Cleveland Indians, in exchange for minor league left-hander Giovanni Soto, prior to the game...Detroit manager Jim Leyland was suspended for his actions in Monday's game and missed Wednesdays' game...The Rays 17-6 record in July is also the best mark for the month in franchise history...Tampa Bay improved to 18-9 versus the AL Central...Zobrist left the game with lower back stiffness and is listed as day-to-day...The Rays television crew called the game from beyond the centerfied wall.