Johnson (8-11) allowed two runs and four hits while striking out seven. He won for the first time since Aug. 3 at Washington.
Greg Dobbs drove in two runs for Miami. The Marlins had 12 hits, three by Donovan Solano.
The Brewers lost for just the fourth time in 17 games. A day earlier, they pulled within 6 1/2 games of the second NL wild-card spot.
The Marlins scored three runs in the first inning as Solano, Jose Reyes and Dobbs each drove in a run off Marco Estrada (2-6).
An error by second baseman Rickie Weeks, who starred Wednesday night with a pair of two-run homers, let the Marlins stretch their lead to 4-0 in the second. Donnie Murphy doubled and scored on the misplay.
The Brewers had averaged 7.7 runs in the previous seven games, but did little against Johnson.
Norichika Aoki tripled in the third to extend his hitting streak to 10 games and scored on a sacrifice fly by Ryan Braun.
The Brewers pulled to 4-2 in the seventh on a sacrifice by Aoki.
Giancarlo Stanton and Dobbs doubled in the eighth and Murphy added an RBI single.
NOTES: Brewers 3B Aramis Ramirez was held out with a lower back and oblique strain. He aggravated the injury during an at-bat on Wednesday and was pulled. ... Aoki has had three hitting streaks of at least 10 games,