SAN FRANCISCO – With Tim Lincecum’s right knee throbbing, Chase Utley hustled out toward the mound to apologize that his bat had struck the pitcher.

A tense four-game series featuring a benches-clearing brawl between NL division leaders ended with an act of sportsmanship.

“He said, ‘Sorry, man,’ ” said Lincecum, San Francisco’s ace. “Bad hop. Bad luck.”

Lincecum stayed sharp until Utley accidentally lost his grip, and the Giants ended the Philadelphia Phillies’ season-high nine-game winning streak, posting a 3-1 victory Sunday.

Jeff Keppinger had four hits as the Giants spoiled Roy Oswalt’s return from the disabled list and avoided a four-game sweep.

“That was one of the biggest games of the year, really,” Giants first baseman Aubrey Huff said. “Four-game sweeps are tough to deal with, especially in your home yard.”

Lincecum (10-9) went down in the eighth inning when Utley’s bat skittered back at him. He stayed in the game butr left later in the inning, having allowed seven hits and one run, in 72/3 innings.

PADRES 7, PIRATES 3: Pittsburgh finished up the worst homestand in its 125-year history and lost its 10th straight overall.

The Pirates became the first team to go 0-7 or worse on a homestand since Kansas City in May 2006.

BRAVES 6, METS 5: Jason Heyward, Alex Gonzalez and Jose Constanza homered early for visiting Atlanta, Dan Uggla extended his hitting streak to 28 games, and Chipper Jones hit a tiebreaking single in the ninth.

BREWERS 7, ASTROS 3: Zack Greinke tied a season high by going seven innings, and Prince Fielder homered to help visiting Milwaukee to its sixth straight win.

CARDINALS 8, MARLINS 4: Matt Holliday drove in three runs with a pair of two-out singles, Albert Pujols homered, and St. Louis completed its first four-game series sweep on the road since 2004.

DIAMONDBACKS 4, DODGERS 3: Cody Ransom made his first career homer a memorable one, lifting a two-run shot off All-Star Clayton Kershaw in the seventh inning to help Arizona rally past visiting Los Angeles.

REDS 8, CUBS 7: Ryan Hanigan hit a tiebreaking single off Sean Marshall in Cincinnati’s two-run eighth inning as the visiting Reds ended Chicago’s seven-game winning streak.

NATIONALS 3, ROCKIES 2: Jonny Gomes hit his first home run for Washington, and Jayson Werth delivered a tiebreaking single in the eighth inning at Denver.

AMERICAN LEAGUE

WHITE SOX 7, TWINS 0: Jake Peavy tossed eight scoreless innings to win for the first time in more than six weeks, and Chicago completed a three-game sweep at Minneapolis.

ROYALS 4, TIGERS 3: Johnny Giavotella hit his first major league home run and doubled as Kansas City won at home.

BLUE JAYS 7, ORIOLES 2: Ricky Romero pitched eight innings of four-hit ball, and Brett Lawrie hit his first major league homer for visiting Toronto.

ATHLETICS 5, RAYS 4: Josh Willingham led off the 10th inning with a home run to give Oakland a win at St. Petersburg, Fla.

ANGELS 2, MARINERS 1: Ervin Santana pitched into the ninth inning, and Mark Trumbo homered off Felix Hernandez as Los Angeles beat visiting Seattle.

RANGERS 5, INDIANS 3: Elvis Andrus delivered a two-run single for the tying and go-ahead runs in a five-run eighth, and Texas rallied for a victory over visiting Cleveland.