Sanchez erased a 1-0 deficit in the second inning with a run-scoring groundout, then delivered a two-run double in the fourth for a 3-1 Giants lead.
Petit (2-0) struck out 10, yielding two runs on seven hits with a walk.
The rookie right-hander, making his second major league, also provided an RBI single as the Giants took 2-of-3 from the Diamondbacks.
Arizona's Patrick Corbin (13-5) was tagged for five runs on nine hits over five full innings.
Susan Sarandon 'very excited' about daughter's pregnancy
Interpol investigating stolen passports on missing flight