Sandoval's two-run home run in the bottom of the sixth sealed the victory.
Ryan Vogelsong (13-9) pitched six innings for the Giants, surrendering only one run from Chase Headley.
Casey Kelly allowed two runs on seven hits and four walks over 4 1/3 innings for the Padres, who have lost three of their last four games.
The Giants have won nine of their last 10 games and could potentially clinch the Western Division as early as Saturday.
India Supreme Court upholds old law that gay sex is criminal offense
Workers accuse National Zoo of animal mismanagement