Madison Bumgarner had a rare opportunity for a pitcher: Pinch-hit with two outs in the ninth inning with his team trailing by one run.

But Bumgarner, whose four homers are tops among major league pitchers, did not deliver this time for the San Francisco Giants. He struck out swinging against Trevor Rosenthal on a 97 mph fastball and the St. Louis Cardinals held on for a 4-3 victory Wednesday night.

"We were going for it," manager Bruce Bochy said. "He's got more home runs than who I had on the bench. He had a hit (Tuesday) night and I was going with the hot hand. I knew he was going to give us some good swings and he did."

Bumgarner took mighty swings but whiffed on all three strikes he saw.

"I'm not looking for excitement. I'm here trying to help us win games," Bumgarner said. "I take that just as serious as I do pitching. He's one of the best closers in the game. I'm just trying to hit the ball."

Yadier Molina's 100th career home run in the bottom of the eighth inning snapped a tie.

Molina added an RBI single in the first and rookie Stephen Piscotty homered in the third for St. Louis, which took two of three from the NL West-contending Giants. The Cardinals are 77-43 overall and 46-19 at home, both tops in the majors.

Kevin Siegrist (5-0) allowed a walk in the eighth and Rosenthal earned his 38th save in 40 chances. Siegrist won both of the games in the series and Hunter Strickland (2-3) took both losses.

The Cardinals wrapped up a 6-3 homestand with three 2-1 series wins and have won six consecutive series overall. The cooled off the Giants are still an NL-best 23-13 since July 7.

Brandon Crawford and Kelby Tomlinson had two hits and an RBI apiece for the Giants, who missed a chance to pull one game behind the Dodgers in the NL West.

Piscotty's second career homer put the Cardinals ahead 2-0 in the third, two innings after center fielder Juan Perez scaled the wall to rob him of a long ball in one of the top defensive plays of the season at Busch Stadium.

"It was close enough for me to get the ball and I made a great catch," Perez said.

"It's tough, but he made an unbelievable catch," Piscotty said. "Good for him. I wish i would have had that homer but that was a nice play."

The Giants' Matt Cain ended a run of four poor starts, allowing two runs in six innings, and contributed a bases-loaded sacrifice fly. The Cardinals' Jaime Garcia gave up three runs in 6 1/3 innings.

The Cardinals manufactured the tying run in the seventh on two hits, one of them an unintentional swinging bunt by Brandon Moss, and a fielder's choice RBI. Rookie Tommy Pham's headfirst slide dislodged the ball from catcher Andrew Susac on Matt Carpenter's grounder to second.

"It was a bang-banger," Susac said. "You have to give him a path to slide. It was a tough play."

More From KHMO-AM 1070, News-Talk-Sports