Lincecum (7-13) allowed one run over 5 2/3 innings and increased the Giants' lead over the second-place Dodgers to 1 1/2 games.
Buster Posey drove in two runs for the Giants, who won for the fourth time in five games, and Angel Pagan went 3-for-5 with an RBI.
Matt Kemp averted the shutout with an RBI in the sixth inning. Joe Blanton (8-12) took his third consecutive loss, allowing four runs on 10 hits over 5 2/3 innings.
Notable deaths of 2014 [PHOTOS]
UPI horse racing roundup