Brandon Belt led off with a single against Fernando Rodriguez. Wilton Lopez (5-3) then came in to pitch, and Arias -- batting for Gregor Blanco -- greeted him by smacking a double into the left-field corner, producing a 2-2 deadlock.
Sanchez then came up for pitcher Santiago Casilla (5-5) and blooped a single to center field, chasing home Arias with decisive tally.
Sergio Romo garnered his seventh save with a 1-2-3 bottom of the ninth for the National League West-leading Giants, who took the opener of a three-game series.
Cain had held the Astros to two runs on six hits over 7 1/3 innings.
Houston starter Bud Norris limited the Giants to one run on six hits over 6 2/3 frames, striking out seven.
Disney's 'Jessie' to feature network's first engagement
Members of Congress to keep receiving porn magazine