Brewers beat Giants, William Contreras homers

 (Photo by Stacy Revere/Getty Images)

William Contreras homered and drove in three runs, and the Milwaukee Brewers held off the San Francisco Giants for a 7-5 win on Sunday.

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.

RELATED: Check out the new and improved FOX Sports app

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.

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.

SIGN UP TODAY: Get daily headlines, breaking news emails from FOX6 News

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.