MILWAUKEE - When first asked, Madison Bumgarner was unsure what the key to his recent success has been. But like his sixth inning, he quickly figured it out.

Bumgarner won another game in May and three San Francisco Giants homered in a 6-3 victory over the Milwaukee Brewers on Tuesday night.

Bumgarner (6-2) gave up four hits and three earned runs in six innings to improve to 5-1 in his last six starts. He's also 9-1 in May the last two seasons.

"There really hasn't been a key, I've kind of had everything going," Bumgarner said. "That's it, just making pitches and getting outs. Our offence has been scoring a lot of runs. I guess if there's a key, it would be to drive in more than we let in. We'll go with that one."

Matt Duffy, Hunter Pence and Brandon Belt hit home runs and Santiago Casilla earned his 13th save for San Francisco, now 10-2 in its last 12 games.

Milwaukee lost its fourth straight and is 1-6 over the last seven.

Matt Garza (2-7) struggled again, allowing eight hits and five earned runs in five innings. The right-hander has lost his last four decisions, owns just one victory in his last eight starts and is 0-4 at Miller Park.

"It's an adversity period in my life, in my career," Garza said. "I'll just keep pounding the pavement, keep grinding."

The Brewers already trailed 5-0 when they got their first hit off Bumgarner in the fourth on a solo homer by Aramis Ramirez.

In the sixth, a run-scoring double by Ryan Braun cut San Francisco's lead to 5-2 and put runners at second and third with no outs. But after Ramirez's sacrifice fly trimmed it to 5-3, Bumgarner got Jason Rogers to pop out to second before Hector Gomez's sharp line drive was caught by diving shortstop Brandon Crawford.

"That was big," San Francisco manager Bruce Bochy said. "That saved us a run there. But that's 'Craw.' He's as good as there is at short. He's got a lot of range and is so athletic, it didn't surprise us."

Pence's solo homer came in the first and Duffy's two-run shot just over the leaping glove of centerfielder Carlos Gomez made it 5-0 in the fourth. The Giants increased their lead to 6-3 on a solo blast by Belt in the seventh.

BUMGARNER AGAINST BREWERS

The pitcher is 5-2 in his career against Milwaukee. He made his first start at Miller Park since 2012 and has allowed just four earned runs in 21 2/3 innings there.

CAREER BEST FOR POSEY

Buster Posey set a career high when he reached base in his 26th straight game when he was walked in the fifth. He was 0 for 3, however, to end his hitting streak at 16 games.

TRAINER'S ROOM:

Giants: Matt Cain threw 25 pitches to three batters in a simulated inning Tuesday afternoon. He began the season on the disabled list and hopes to return before the All-Star break in July.

Brewers: Jonathan Lucroy will begin a rehab assignment Thursday with Class A Brevard County and hopes to join Milwaukee Monday in St. Louis. The catcher has been on the disabled list since April 20. ... RHP David Goforth was recalled from Triple-A Colorado Springs Tuesday to take the spot of Wily Peralta, who was placed on the 15-day DL with a strained left oblique. He made his major league debut in with one out in the ninth.

UP NEXT:

Giants: Ryan Vogelsong (3-2, 4.60 ERA) is 3-0 with a 1.05 ERA in his last four starts.

Brewers: Mike Fiers (1-4, 4.63 ERA) will pitch on short rest as a replacement for injured Wily Peralta.