The Giants finished off a 5-1 homestand with back-to-back shutouts of the Cubs to end a three-game series.
Lincecum labored through his five innings despite not giving up a hit and the Giants pinch-hit for him in the fifth inning.
The two-time Cy Young Award winner threw 52 of his 96 pitches for strikes, walking four and hitting one batter. He struck out five.
Edwin Jackson (3-5) struck out nine but took the loss, giving up two runs on four hits and two walks in 5 1/3 innings.