SAN FRANCISCO (AP) — Chicago’s slumbering offense woke up just long enough to give the San Francisco Giants a scare.

Like much of the season, the Cubs just couldn’t keep it going.

Alfonso Soriano hit a three-run in the ninth inning and Chicago had the go-ahead run at second base before falling short in a 4-3 loss to the Giants on Friday night that ended the Cubs’ longest winning streak of the season.

“We made a heck of comeback there,” Chicago manager Dale Sveum said. “We just came up short. The big key to the game was the first inning. We get a guy in scoring position and then we struck out three times.”

The Cubs indeed had San Francisco starter Madison Bumgarner on the ropes early, putting runners on the corners in both innings. Each time, Bumgarner pitched his way out of trouble.

After that, Chicago didn’t muster much offense at all until Soriano’s home run off Giants closer Santiago Casilla in the ninth ended the shutout bid.

It wasn’t enough, however, to keep the Cubs from losing for the 15th time in their last 20 games.

“It was tough to time him and tough to see the ball,” Soriano said of Bumgarner. “It was disappointing because he throws eight shutout innings. There’s nothing you can do about it.”

It didn’t help that Giants slugger Melky Cabrera remained the hottest hitter in the National League.

Cabrera had two hits to raise his average to .376, tying him with Paul Konerko of the Chicago White Sox for the highest mark in the majors. That comes on the heels of his outstanding May when he tied a San Francisco franchise record with 51 hits.

Ryan Theriot added three hits and scored twice while Buster Posey had two RBIs to give the Giants their fourth win in five games on the current homestand.

Coming off one of his worst starts of the season, Bumgarner looked strong after overcoming some early struggles. He retired 17 of 20 batters during one stretch before tiring in the ninth.

Chicago tried to take advantage after Bumgarner gave up back-to-back singles to Starlin Castro and Joe Mather to open the inning. After Soriano homered to cut San Francisco’s lead to 4-3, Jeff Baker hit a one-out double, Casilla retired Reed Johnson on a comebacker but allowed a double to Jeff Baker and an infield single to Darwin Barney.

Casilla injured his right knee while fielding the ball on Barney’s hit and left the game, but the Cubs couldn’t do anything against Javier Lopez who recorded the final two outs for his first save of the season.

Chicago starter Paul Maholm had another rough outing.

The Cubs’ lefty walked leadoff hitter Gregor Blanco in the first then gave up an RBI double to Theriot. Cabrera followed with a single before Posey’s sacrifice fly made it 2-0.

Maholm (4-4) was tagged for two more in the third and left after giving up a one-out single to Brett Pill in the sixth. He struck out four and walked two.

“I would have liked to go much deeper in the game and gotten off on a better note,” Maholm said. “I wish I could have buried those breaking balls a bit better.”

Chicago, which was coming off a three-game sweep of San Diego, didn’t show much life offensively until Soriano’s home run in the ninth.

The Cubs hit into two double plays and had a runner thrown out easily trying to steal second.

That was more than enough to support Bumgarner (6-4), who scattered eight hits over eight innings and finished with a season-high 11 strikeouts to earn his first win since May 5.

Cabrera singled as part of a two-run first inning, tripled in Theriot in the third and later scored on Posey’s single to right that gave the Giants a 4-0 lead. He also grounded into a double play and flew out to deep center in his other at-bats.

Notes: The Cubs claimed RHP Jairo Asencio off waivers, the reliever’s third team this season. Asencio went 1-1 with a 5.96 ERA over 25 2-3 innings for Cleveland before getting designated for assignment on Monday. To make room, Chicago designated RHP Michael Bowden for assignment. … RHP Matt Cain (5-2), who pitches for San Francisco on Saturday, has not allowed a run in 15 consecutive innings against the Cubs. He’ll oppose RHP Matt Garza (2-3).

© 2012 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.

Watch & Listen LIVE