The teams split their four-game series.
Lincecum (6-11) allowed a leadoff double to Juan Francisco in the third and walked Jeff Bianchi with one out in the sixth. No one else reached base off the two-time Cy Young Award winner, who struck out eight.
His previous victory had come on July 13 in a 9-0 blanking of San Diego.
Brandon Belt gave Lincecum the early lead with a three-run homer in the first. Brandon Crawford drove in the other San Francisco run with a single in the second.
The Brewers scored their run in the ninth off Sandy Rosario.
The loss went to Donovan Hand (0-4), who allowed four runs on seven hits in five innings.
Notable deaths of 2014 [PHOTOS]
UPI horse racing roundup