Jordan Zimmermann (19-9) missed his only shot at 20 wins, allowing four runs in seven innings. The Nationals had five hits one day after breaking up rookie Michael Wacha's bid for a no-hitter in the ninth inning.
Matt Adams hit his eighth home run since replacing injured Allen Craig and doubled for the Cardinals, who led the Pirates by 2 1/2 games with three games to go. The Reds lost 1-0 to the Mets on Wednesday and were eliminated from the divisional race.
The Cardinals (94-65) are a season-high 29 games above .500 and have a day off before 14-game winner Lance Lynn faces the Cubs on Friday night to open the final series.
Miller (15-9) was wild high early and walked two of the first three hitters to set up Bryce Harper's RBI single. The Nationals had no other runners in scoring position against the 22-year-old Miller, who allowed a run in six-plus innings and beat them for the second time this season.
Rookie Trevor Rosenthal saved all three games and struck out Adam LaRoche to cap a perfect ninth.
Zimmermann had won his previous four appearances and had been coming off a two-hit shutout of Miami. But he is 0-3 with a 8.27 ERA in six career starts against St. Louis, and lost Game 2 of the NL division series last fall.
Daniel Descalso doubled leading off the third and scored on Matt Carpenter's groundout to tie it. Zimmermann hit Matt Holliday to open the fourth, and Adams doubled ahead of Molina's two-run single that made it 3-1.
Adams hit his 17th homer on a 1-2 pitch in the sixth.
The Cardinals were 15-2 against the NL East and swept Miami and Philadelphia.
NOTES: Zimmermann has 43 career wins, one shy of the Nationals' franchise record held by Livan Hernandez. ... Miller leads all rookies with 15 wins, also the most by a Cardinals rookie since Dick Hughes won 16 in 1967. ... Lynn (14-10, 4.09) faces Travis Wood (9-11, 2.98) on Friday. Stephen Strasburg (7-9, 3.02) gets his final start on Friday at Arizona against Patrick Corbin (14-7, 3.28).
Link to box score: St. Louis 4, Washington 1
Link to game discussion at The Cardinal Nation message board