Brett Pill's pinch-hit solo homer in the eighth inning was the difference, as San Francisco topped Los Angeles, 4-3, in the finale of a four-game series.
Pill went deep off Paco Rodriguez (3-3) to give the visitors a one-run edge, and Sergio Romo eventually gained his 35th save, but not before walking a tightrope in the ninth.
Nick Buss led off with a single, then was sacrificed to second. Dee Gordon followed with a base hit and stole second to put two runners in scoring position with one out. Mark Ellis fanned but Adrian Gonzalez was given a free pass to load the bases. However, pinch-hitter Yasiel Puig grounded into a force at second to end the game.
Jean Machi (3-1) tossed a scoreless seventh frame for the defending World Series champs, who have won seven of their last 10.