Ben Zobrist finished 3-for-5 and drove in 2 victory over game series from Camden Yards.
Sean Rodriguez and Johnny Damon added an RBI each for the Rays, who have won five straight and eight of nine to reduce their deficit to idle Boston in the AL wild-card race to three games. After this series, the Rays play at Fenway Park in a four-game set.
"We feel in control of what we do here," Rays manager Joe Maddon said. "That's their gig up there and I know how that all works. From our perspective, we can't worry about things like that. Hopefully it's going to work to our advantage somehow."
Jeff Niemann (10-7) worked 7 2/3 innings for the win, scattering six hits and two runs while fanning five and walking two.
Matt Wieters homered for the Orioles, who have lost three in a row and seven of 10.
Zach Britton (9-10) was tagged for five hits and four runs with four walks over five full frames in defeat.
"I left some balls up in some situations where I put some guys on," Britton said. "I made a lot more stress for myself."
Tampa Bay jumped out to a 3-0 lead in the third. Brandon Guyer led off with a double, and B.J. Upton worked a one-out walk. Evan Longoria lined out but Zobrist plated two with a double. Damon walked and Rodriguez scored Zobrist on a single.
A Damon sacrifice fly put the Rays up 4-0 in the fifth, but Robert Andino's RBI double in the home half gave the O's their first run.
Wieters hit a two-out solo shot in the sixth to bring the O's within 4-2, but Upton doubled to begin the seventh, moved up on a Longoria fly and came home on a Zobrist single.
Joel Peralta followed by tossing a perfect ninth to earn his third save.
Tampa Bay has won nine of 16 games against Baltimore this season, but won for just the fourth time in 10 home dates with the Charm City club...Orioles outfielder Adam Jones missed his third straight game with a right thumb injury...Prior to the contest, Baltimore activated pitcher Jason Berken from the 15-day disabled list, while Tampa Bay designated pitcher Rob Delaney for assignment.