The two unearned runs in the inning gave the Giants a three-run cushion and Javier Lopez worked out of an eighth-inning jam to preserve the victory.
San Francisco had a 4-3 lead heading into the sixth and put Arias and Crawford in scoring position with two away.
Gregor Blanco then hit a grounder to second baseman Logan Forsythe, who misplayed it for an error that allowed both runners to score.
The Giants took the lead for good with a three-run first. Melky Cabrera drove in the opening run of the inning with a double and scored the third one on a passed ball.
Madison Bumgarner (7-4) lasted six innings to get the win. He allowed four runs on seven hits with four walks and four strikeouts.
Lopez came on in the eighth with two on and two out and needed just two pitches to retire Bill Kotsay on a grounder back to the mound. Sergio Romo struck out two in a perfect ninth to record his third save.
The loss went to starter Clayton Richard (2-7), who was touched for four earned runs on 10 hits in 5 2/3.
Gal Gadot cast as Wonder Woman for 'Batman vs. Superman'
Toddler uninjured after being knocked over by Obama family dog