Kennedy (18-4) became the first National League pitcher to reach 18 wins with his 21st quality start of the season. The right-hander held the Giants to one run on five hits over seven frames. He walked two and struck out six.
Paul Goldschmidt's homer broke a 1-1 tie in the fourth inning and he added an RBI single in the next frame as the NL West-leading D-backs pounded out 12 hits en route to a crucial win over second-place San Francisco.
Arizona won for the 10th time in 11 games and improved its lead over the Giants to six games.
San Francisco's Tim Lincecum (12-12) was the loser, giving up five runs on nine hits and three walks over five innings, while fanning seven.
Pablo Sandoval drove in both Giants runs with sacrifice flies.