Pirates at home for wildcard game
Neil Walker hit two of Pittsburgh's six home runs as the Pirates beat the Cincinnati Reds 8-3.
Andrew McCutchen, Pedro Alvarez, Marlon Byrd and Andrew Lambo also went yard for the Pirates, who secured the number one wildcard spot ahead of Cincinnati for their first play-off action since 1992.
Jay Bruce drove in a pair for the Reds.
The battle for the two American League wildcard places will go to the final day with Cleveland one game ahead of the Tampa Bay Rays and the Texas Rangers after the Indians beat the Minnesota Twins 5-1.
Scott Kazmir fanned 11 in six innings of one-run ball and Carlos Santana smacked a two-run homer for the Indians, who extended their winning streak to nine matches to put themselves in the driving seat.
The Tampa Bay Rays fell a game back as they lost 7-2 to the Toronto Blue Jays, with Ryan Goins and Kevin Pillar both launching two-run homers.
JA Happ hurled 7 1/3 innings of one-run ball for the Blue Jays, striking out four.
That allowed the Rangers to draw level with the Rays as they beat the Los Angeles Angels 7-4 for their sixth straight win.
They got a little help on the way - the Angels made five errors and only four of their runs were earned - but each of the nine Rangers batters had a hit and Ian Kinsler scored twice.
The AL wildcard game is set for Wednesday but there could yet be tiebreaker games played on Monday and Tuesday to decide which teams play in it and where.
The Boston Red Sox secured the AL's best record and homefield advantage throughout the play-offs despite losing 6-5 to the Baltimore orioles
Steve Pearce's two-RBI double in the eighth saw the Orioles rally for victory, but by that time the Red Sox had already had good news from Seattle where the Oakland Athletics lost 7-5 to the Mariners.
Rookie shortstop Brad Miller hit two homers including a grand slam for the Mariners, meaning the A's will be the AL's second seeds and will face the Detroit Tigers, while the Red Sox face the winners of the wildcard game.
Matt Holliday homered in the first to set St Louis on their way to a 6-2 win over the Chicago Cubs, putting them in control of the battle to be the NL's top seeds.
Adam Wainwright picked up his 19th win of the season for the Cardinals who pulled one clear of Atlanta thanks to the Braves' 5-4 loss against the Philadelphia Phillies.
Should the Cards lose and the Braves win on Sunday, Atlanta would be top seeds having won the season series between the two teams.
Andy Pettitte ended his career with a complete game as the New York Yankees beat the Houston Astros 2-1.
Facing the only other team he has ever played for, Pettitte, 41, allowed one run on five hits, striking out five and walking two, in his first complete game since 2006 and the 256th win of his career.
There were also wins for the San Diego Padres, the Milwaukee Brewers, the Miami Marlins, the Chicago White Sox, the Washington Nationals and the Colorado Rockies.