Kennedy (4-5) ended a personal five-game losing streak, giving up five hits and walking two before giving way to David Hernandez.
Hernandez worked his way out of a two-out, two-on jam in the eighth and survived a leadoff single in the ninth to pick up his first save.
Arizona scored an unearned run in the second and the score was tied at 1-1 when Paul Goldschmidt hit a solo homer in the sixth off Tim Lincecum. Goldschmidt and Ryan Roberts both had an RBI single in the eighth.
Lincecum (2-6) lost his fourth straight decision and will finish May without a win. He gave up just two runs on four hits in seven innings, but walked five.