SAN FRANCISCO -- Matt Cain had his best outing in nearly a month, Nate Schierholtz added three hits and made an outstanding defensive play and the San Francisco Giants beat the Arizona Diamondbacks 3-2 Thursday to complete a perfect homestand.