PHOENIX - Yovani Gallardo outpitched Chase Anderson in seven strong innings, Carlos Gomez extended his hitting streak to 15 games and the Milwaukee Brewers beat the Arizona Diamondbacks 4-1 on Thursday.

A day after losing to Arizona on a walk-off hit, the Brewers beat the Diamondbacks for the third time in four games behind Gallardo (5-4). The right-hander held Arizona to a run over seven innings for his 86th career win, tying Ben Sheets for fifth on Milwaukee's all-time list.

Gallardo improved to 7-0 in 10 career starts against Arizona.

Francisco Rodriguez worked around a hit in the ninth inning for his majors-leading 23rd save this season and 327th career, moving past Roberto Hernandez for 14th all-time.

The Brewers strung together three runs off Anderson (5-2), who lost his second straight start despite pitching well.

Gomez had a run-scoring single in the eighth inning to reach base for the 32nd straight game, the majors' longest active streak.

Gallardo retired the first 10 batters he faced until Chris Owings blooped a single to right in the fourth inning. Owings reached third, but Gallardo stranded him there.

The Diamondbacks had two hits to start the fifth inning and scored a run on Didi Gregorius' grounder, but that was it off Gallardo. He allowed five hits and struck out four.

Anderson wasn't bad, either.

He had a superb start to his major league career, becoming the first Diamondbacks rookie to win his first five starts. Even though he pitched well, his run came to an end in his last start, when he allowed two runs on four hits in five innings of a 4-3 loss to the Los Angeles Dodgers.

The right-hander was good again against the Brewers, holding them without a hit until Aramis Ramirez led off the fifth inning with a double.

Lyle Overbay followed with a run-scoring double and Elian Herrera added an RBI single to put Milwaukee up 2-0.

Ramirez made it 3-1 with a run-scoring single in the sixth after Jean Segura wound up on second with an infield single and a throwing error by Anderson.

Anderson allowed two earned runs on five hits and struck out five in six innings. He's allowed two earned runs or less in six of seven starts.

Gomez struck out three times before hitting a run-scoring single in the eighth off Matt Stites, who made his major league debut.

NOTES: Gregorius, a shortstop throughout his career, made his first career start at third base to give Martin Prado a rest. He was tested right away and made a nice play, snaring leadoff hitter Scooter Gennett's sinking liner. ... Brewers OF Ryan Braun, who has played 999 career games, and C Jonathan Lucroy were given the day off. ... RHP Josh Collmenter will start Friday when the Diamondbacks open a three-game series against San Francisco. RHP Marco Estrada will pitch for the Brewers to start a three-game road series against Colorado on Friday.