SAN FRANCISCO (AP) -- Melky Cabrera isn't slowing down even though the calendar has changed.
The Giants slugger continues to be the hottest hitter in the National League and now he's helping San Francisco get back into the division race.
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 while helping the Giants to a 4-3 win over the Chicago Cubs on Friday night.
It comes on the heels of Cabrera's outstanding May when he tied a San Francisco franchise record with 51 hits.
More significantly, it helped the Giants pull within four games of first-place Los Angeles in the NL West after trailing by 7 1/2 games only six days ago.
"That month is over," Cabrera said of his franchise record-tying performance in May. "I never think about what day it is or anything like that. I just try to do my best to help the team and I'm happy I'm doing that right now."
The Giants won for the fourth time in five games but it might have come at a price.
Closer Santiago Casilla injured his right knee three batters after giving up a three-run home run to Alfonso Soriano in the ninth. Casilla left the game on his own power and was being examined by team doctors after the game.
If Casilla is lost for any length of time it would be a blow to San Francisco's bullpen which has already lost the team's original closer, Brian Wilson , to a season-ending injury.
"We'll see how he's doing tomorrow," Giants manager Bruce Bochy said. "His foot slipped out a little bit from the shoe and I think that's when he did it."
Javier Lopez replaced Casilla and recorded the final two outs for his first save of the season.
The ninth inning drama nearly overshadowed a stellar outing by pitcher Madison Bumgarner who pitched into the ninth inning to pick up his first win in nearly four weeks.
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 and carried a shutout into the ninth before tiring.
Bumgarner (6-4) didn't walk a batter and finished with a season-high 11 strikeouts.
"He pitched well in traffic, settled down and threw a great game," Bochy said. "He really had his stuff going tonight. You can't ask for more than what he did."
Ryan Theriot added three hits and scored twice while Buster Posey had two RBIs to help the Giants improve to 4-1 on the current homestand.
The Cubs put the go-ahead runs on the base in the ninth with one out but couldn't complete the comeback and lost for the 15th time in their last 20 games.
After Bumgarner gave up back-to-back singles to Starlin Castro and Joe Mather to open the inning, Casilla gave up Soriano's home run that cut San Francisco's lead to 4-3.
Casilla retired Reed Johnson on a comebacker but allowed a double to Jeff Baker and an infield single to Darwin Barney . Lopez relieved Casilla and got Steve Clevenger to ground out to first then retired pinch-hitter David DeJesus on a fly out to enter.
"We just came up short," Chicago manager Dale Sveum said. "We just couldn't muster up nothing for the first eight innings off Bumgarner. Those runs they scored took the momentum right from us."
Cabrera continues to be the Giants most significant offseason acquisition.
He 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.
That was more than enough support for Bumgarner, who scattered eight hits over eight innings to earn his first win since May 5.
Chicago starter Paul Maholm wasn't as fortunate.
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.
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.
Angel Pagan singled in the third inning for San Francisco to extend his home hitting streak to 25 games, the longest in Giants franchise history.
Notes: Injured Giants 3B Pablo Sandoval could begin a rehab assignment in the minors as soon as this weekend. Sandoval is expected to play four to five games with Class-A San Jose and will bat mostly from the left side while he continues to recover from surgery on his left hand. ... 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). ... Pill's stolen base in the sixth was the first of his career.