Rookie Madison Bumgarner pitched into the eighth inning and the San Francisco Giants got home runs from Pablo Sandoval and Aubrey Huff, sending the St. Louis Cardinals to their season-worst fifth straight loss with a 6-3 victory on Friday night.

Albert Pujols hit his 398th career homer for the Cardinals, who led the NL Central by a game after a dramatic sweep of the Reds on Aug. 11, but have dropped five of six since then and began the night 3½ games behind Cincinnati. Pedro Feliz singled and scored twice and handled two chances at third base in his debut with St. Louis.

Buster Posey doubled twice with an RBI off Jake Westbrook (1-1) for the Giants, who have won two straight after dropping four of the previous five to stay in the thick of the wild card picture.

The 21-year-old Bumgarner (5-4) scattered eight hits over seven innings and worked out of trouble twice. Felipe Lopez popped up with the bases loaded to end the second when the Cardinals scored once on four hits, and Matt Holliday grounded into a double play with two men on to end the fifth.

Bumgarner scattered nine hits and was hurt only by Brendan Ryan's bases-loaded infield hit in the second and Pujols' 32nd homer leading off the eighth, also the last batter he faced. The left-hander, the Giants' first-round pick in 2007, had been 0-2 the last four starts but has won all of his games on the road.

Pujols also singled and walked. He leads the NL with 32 homers and tied Dale Murphy for 49th place on the career list. Pujols has nine homers in his last 16 games.

Westbrook, the last Cardinals pitcher to win, allowed three runs on seven hits in six innings. The right-hander was in trouble in four innings, stranding two runners in the first and fifth, giving up two runs on four hits in the second, and surrendering Sandoval's 10th homer in the third.

The Giants had four hits in a stretch of five at-bats in the second, including Bumgarner's second career RBI on a single he bounced up the middle and Posey's RBI double.

Sandoval homered for the second straight game and fourth time in eight games, a stretch that followed a 47-game homerless drought. Huff had been 1 for 14 against the Cardinals before ending a 69 at-bat homer drought with his 21st in the seventh off Blake Hawksworth, and reached base four times adding a single and two walks.

Brian Wilson worked the ninth for his 35th save in 38 chances.

NOTES: Giants SS Juan Uribe was not in the lineup after fouling a ball off his left foot Thursday. X-rays taken before the game were negative. ... Westbrook fell to 20-10 in August, his best month for victories. ... Giants pitchers have earned victories the last two starts after going 14 consecutive starts without one. ... Giants RHP Tim Lincecum, who opposes the Cardinals' Chris Carpenter on Saturday night, has allowed 14 earned runs in 14 innings while losing three straight starts. It's the first three-game losing streak for the pitcher who's won the last two NL Cy Young awards. ... Paid attendance of 43,822 was the Cardinals 23rd sellout.