Lilly (11-14) allowed all four hits and struck out seven over 6 1/3 innings. Mike MacDougal, Kenley Jansen and Javy Guerra combined to allow only one base runner the rest of the way while striking out five. Guerra recorded his 20th save.
Los Angeles snapped San Diego's three-game winning streak.
The Dodgers scored a run in the second when Jerry Sands came in on a groundout by Russ Mitchell. Matt Kemp hit his 37th homer in the seventh.
Wade LeBlanc (4-6) struck out 10 over seven innings, but allowed both Los Angeles runs to take the loss.