The Giants maintained a nine-game lead over the Los Angeles Dodgers in the National League West with both teams having 13 games remaining.
San Francisco's first three batters scored in the opening inning off Tyler Chatwood (4-5), who lasted just four innings in taking the loss.
Angel Pagan singled to open the inning, Marco Scutaro doubled and Sandoval then hit his homer to right.
Brandon Belt also contributed a two-run double during San Francisco's three-run fifth.
Matt Cain (15-5) coasted to the win, giving up a run on four hits with eight strikeouts over eight innings.
Colorado has dropped five in a row and lost for the 90th time this season.