The Pirates, having climbed into a share of the lead in the National League Central entering the night's action, won their seventh straight game. Pittsburgh needs one more win to reach 50 for the season.
Milwaukee scored all of its runs in the first inning, but Pittsburgh soon took command by sending a dozen men to the plate in the second.
Starling Marte produced an RBI single to tie the score and Pittsburgh went in front for good when Milwaukee shortstop Jean Segura committed a fielding error that allowed two more runs.
Pittsburgh's final two runs in the inning came on singles from Andrew McCutchen and Alvarez.
Gerrit Cole remained unbeaten in his four major-league starts with a six-inning performance. Cole (4-0) allowed eight hits in six innings, but limited the Brewers to three runs.
Ryan Reid was called on to work the final three innings in the sixth appearance of his career and thus earned his first save.
Hellweg (0-1) was brought up from Class AAA Nashville to make the start and he gave up seven runs, five earned, in 1 2/3 innings.
Kate Middleton recycles dress at movie premiere
Couple mistakenly served bag of cash at McDonald's drive-thru