Gallardo (3-4) pitched into the eighth inning for the first time this season, striking out five and giving up five hits while throwing 108 pitches.
Francisco Rodriguez replaced Gallardo in the eighth and worked his way out of a bases-loaded jam.
Arizona's only run came on Jason Kubel's homer in the fourth.
Four of the Milwaukee runs came off Ian Kennedy (3-5), who lasted 5 2/3 innings while giving up seven hits and striking out seven.
UPI horse racing weekend preview
Bo Jackson: I can't help Jameis Winston anymore