Buster Posey hit a two-run homer and Matt Cain bounced back from two rough starts to earn his first win in more than a month as the San Francisco Giants beat the first-place Arizona Diamondbacks for a second straight night, winning 4-3 on Saturday night.