Aurilia hit an RBI single in the top of the third inning and his two-run single in the seventh put San Francisco on top by the final three-run margin.
Lewis launched a three-run homer in the second.
Both players had two hits.
Ray Durham had two hits and two RBI while three players knocked in one run for the Giants, who averted a three-game sweep.
The winner was starter Jonathan Sanchez (6-3).
Closer Brian Wilson earned his 19th save this season with a 1-2-3 ninth.
Colorado's Garrett Atkins had two hits, one a three-run double in the fifth.
Matt Holliday had two hits, including a two-run double in the third.
Yorvit Torrealba added three hits and two RBI for the Rockies, who had won six of seven.
The losing pitcher was starter Greg Reynolds (1-4).