Milwaukee has won back-to-back games for the first time since May 5-6 at Chicago and consecutive home games for the first time since April 19-20 against Houston.
The Reds have lost three straight games for the first time in nearly a month. They had taken a 6-5 lead in the eighth inning on a two-run triple by Felipe Lopez.
Cincinnati's Scott Williamson (3-2) worked through the eighth inning but got in trouble with two walks around a strikeout in the ninth. He struck out John Vander Wal to get within one out of his 10th save, but Perez sent his first pitch over the left field fence for his fifth homer.
Mike DeJean (1-2) worked a scoreless ninth for the victory, striking out two.
Milwaukee opened a 5-2 lead in the fourth on Scott Podsednik's two-run triple off Kent Mercker. Aaron Boone's 11th homer, a two-run shot off Brewers starter Glendon Rusch in the sixth, cut the deficit to 5-4.
After the Brewers struck first with Vander Wal's three-run double in the third, the Reds answered in the fourth with a two-run shot by Adam Dunn off Rusch. Dunn leads the majors with 16 homers, including six in his last six games.
Dunn has three homers in 12 career at-bats against Rusch, who was in position for his first win since April 8 before the Reds rallied for the lead in the eighth.