MILWAUKEE — Matt Cain's struggles continued against the Milwaukee Brewers.
Yovani Gallardo homered and struck out six in his first start since being arrested on a drunken driving charge, and the Brewers beat San Francisco 7-2 Thursday for a three-game sweep.
"We knew how good these guys are," San Francisco manager Bruce Bochy said.
"They will get back on track. It's baseball. We came in here and (Milwaukee) played well. They swung the bats well and they pitched well. These last two games we faced pretty good pitchers and they did a good job on us."
San Francisco lost for the fourth time in six games and fell to 0-4 when Cain pitches.
Cain (0-2) gave up seven earned runs and seven hits while striking out four without a walk in six innings. The Brewers led 7-0 after three innings.
"It didn't really matter what pitch it was in those three innings," Cain said. "Everything was coming back to the middle. Right in the middle. I was just not executing the pitches at all."
Gallardo (1-1) was arrested early Tuesday morning. The right-hander allowed five hits, one walk and one earned run in six innings to give his team its season-high fourth victory in a row after a 1-8 skid.
"It was tough," Gallardo said. "It's obviously something you don't want to ever run into or happen.
"There's different things we all go through, different situations. We all have stuff off the field.
"Something like that is a big deal. It's serious. I apologize. I'm just going to do everything possible and everything I have to do so something like that doesn't happen again."
Ryan Braun and Jonathan Lucroy also homered for Milwaukee, which swept San Francisco for the first time since July 18-20, 2008.
"I think Yo had something to prove and obviously wasn't happy with what happened a few days ago," Milwaukee manager Ron Roenicke said. "And he was determined to go out there and do whatever he could to pitch well, and he did.
"Yo is really well-liked here. And they know how hard it is on him, and what he's going through. I think this is a tight bunch of guys and I think they really pull for each other."
Gallardo's two-run homer was his first of the season and 11th of his career, the most by a Milwaukee pitcher.
Braun hit his third homer of the year, a two-run shot in the first. He had been in a 1-for-18 slump in which he struck out 11 times.
In the second inning, Carlos Gomez was hit with a pitch, stole second and scored on a single by Yuniesky Betancourt. Gallardo's homer to left made it 5-0.
Lucroy added his two-run homer in the third for a 7-0 lead.
Gallardo had allowed 12 earned runs in his past three starts, but his only blemish came in the fourth. He gave up a leadoff double to Brandon Crawford, who scored on a sacrifice fly by Brandon Belt.
Gallardo was aggressive with his fastball and was throwing it for strikes to improve to 40-19 at Miller Park.
"I think he threw really well," Lucroy said. "That's the best I've seen him throw this year. I could tell in the bullpen there was something different about him today."
Once he left, relievers Michael Gonzalez and John Axford each pitched a scoreless inning before Alfredo Figaro gave up a solo homer to Crawford in the ninth. Crawford had three hits.
Cain settled down and retired 11 of his final 12 batters. But he has allowed five homers in his past two games after not allowing one in his first two outings. He has also given up 18 earned runs and 21 hits in his past three starts.
"I will say, Cain gave us a gutty effort," Bochy said. "He regrouped and made a nice adjustment. He pitched great the last three innings. But, when you give up three two-run homers, that is hard to overcome."
NOTES: The last time Milwaukee swept San Francisco at Miller Park was also in 2008. This is the Giants' longest losing streak since dropping five straight from July 25-30 last season. ... This was the fourth time Gallardo and Cain squared off, and all have been at Miller Park. Gallardo improved to 3-1. ... Crawford and Hunter Pence are the only Giants to have started all 16 games. ... Crawford extended his career-high hitting streak to 11 games with a single in the second. ... The Brewers reassigned RHP Mike Fiers to Triple-A Nashville and will announce a corresponding move at a later time. Fiers was 0-1 with an 8.59 ERA in three appearances.