Owen Miller had two hits, scored twice and drove in two runs as Milwaukee salvaged the finale of the four-game series. Brian Anderson had two RBIs, and Christian Yelich walked twice and scored two runs.
The NL Central leaders were shut down by the Giants in the previous three games, only managing two runs and 13 hits.
Mike Yastrzemski and Blake Sabol homered for San Francisco, which had won three straight and 10 of 12 overall. Alex Cobb (4-2) was tagged for seven runs and seven hits in four innings in one of his worst starts of the season.
“My delivery was just off, couldn’t fix it quick enough," Cobb said. “Felt like I started getting rhythm in the third and fourth, but obviously the damage was done."
Anderson hit a two-run double in Milwaukee's three-run first, and the Brewers added four more in the second.
Miller hit a two-run single before Contreras' two-run shot to left made it 7-0. It was Contreras' fifth homer of the season.
“He’s pitching as well as any pitcher in the National League right now," Milwaukee manager Craig Counsell said of Cobb. “The way it worked today, first three guys got on (in the first inning) and we just didn't let him settle in, and that makes any pitcher uncomfortable.”
Milwaukee's Colin Rea (2-3) was charged with four runs and five hits in six-plus innings. He struck out six and walked none.
Yastrzemski hit a solo shot in the third for his sixth homer. Sabol’s sixth homer, a three-run shot in the seventh, made it 7-4 and chased Rea.
Brett Wisely tacked on a sacrifice fly in the seventh against Joel Payamps. But Devin Williams got four outs for his eighth save.
Cobb entered Sunday's outing with the second-lowest ERA (2.17) in the National League and a 0.64 ERA in four career starts against Milwaukee. He struck out five and walked four.
STRIKEOUTS HURTING FRISCO'S ATTACK
San Francisco struck out 11 times, adding to its NL-leading total of 533.
HOT (CORNER) GLOVE
From his knees, Anderson threw out Mitch Haniger after diving to snag Haniger’s 100-mph ground ball just inside the third-base line in the fourth.
Brewers: Miller (forearm contusion) left the game after he was hit by a pitch from Cobb. Counsell said it was a precautionary move. ... OF Jesse Winker (neck discomfort) was scratched.
Giants: Host Pittsburgh for a three-game series starting Monday. Giants LHP Rich Hill (4-4, 4.27 ERA) faces Pirates RHP Anthony DeSclafani (3-4, 3.43 ERA).
Brewers: Off Monday. Start a three-game series in Toronto on Tuesday. RHP Adrian Houser (1-0, 2.25 ERA) faces Blue Jays LHP Yusei Kikuchi (5-2, 4.56 ERA).
AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP-Sports
Copyright 2023 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.