Both National and American League wild card races will go down to the last day of the regular season after Tampa Bay and Boston won on Tuesday while St Louis caught up with faltering Atlanta.
In the AL, Matt Joyce's late three-run homer lifted Tampa Bay to a 5-3 comeback victory over the New York Yankees, while the Red Sox hung on for a shaky 8-7 win over Baltimore.
St. Louis ensured the NL wild card race will also go to the wire after they beat Houston while the Altanta Braves gave up sole possession of the lead with a 7-1 loss to Philadelphia.
If the teams finish tied after their regular season finales on Wednesday, a one-game playoff will decide who advances to the postseason.
The Rays (90-71), who languished Boston by nine games in the wild card race earlier this month, trailed 3-2 to the Yankees on Tuesday before B.J. Upton and Evan Longoria drew walks and Joyce smashed the home run in the seventh inning.
"It's crazy the way this month has gone, it seems like we're clicking on all cylinders," Tampa Bay's Ben Zobrist told reporters. "It's a lot of fun in the clubhouse right now and we're hoping to get one more (win)."
Tampa Bay reliever Jake McGee recorded the win after pitching the seventh inning in relief of starter Jeremy Hellickson, who allowed three runs in six innings.
Kyle Farnsworth nailed down the ninth for his 25th save of the season.
Mirroring the collapse of the Red Sox, the Braves (89-72) held an 8 game lead over the Cardinals at the beginning of the month but are now fighting for their playoff lives.
"It is what it is. We've played 161 games and it comes down to one," said Atlanta manager Fredi Gonzalez. "We've done it to ourselves, there's no excuses. We have to go get it tomorrow."
St. Louis trailed Houston 6-5 after five innings but hit back with four runs in the seventh and three in the eighth to take command.
Chris Carpenter will take the mound for the Cardinals on Wednesday while Tim Hudson takes the ball for Atlanta.
In Baltimore, the Red Sox will hope to finish off the Orioles in smoother fashion than they did on Tuesday when they almost let a late 8-4 lead slip.
The Orioles scored twice in the eighth, and once in the ninth against Boston's Jonathan Papelbon, who needed 28 pitches to escape the final inning with a runner in scoring position.