Sanchez belted a pitch from Juan Perez (0-1) into the Brewers' bullpen in left field leading off the 14th, and the Giants held on to record a win in the first of a three-game series at Miller Park.
Ryan Braun forced extra innings with a game-tying, two-run clout in the eighth for the Brewers.
Aramis Ramirez added an RBI as Milwaukee lost for the seventh time in nine contests.
Duggar sisters unveil Christian dating rules in new book
McPhee, Cokas 'working on their marriage' after affair