Chris Park, Associated Press
San Diego Padres' Adrian Gonzalez, center, is congratulated by his teammates after hitting a walk off three-run homer in the 18th inning.

SAN DIEGO — The lights were on and the sun was going down when Adrian Gonzalez hit a three-run homer with two outs in the 18th inning Sunday to give the San Diego Padres a 12-9 win over Cincinnati.

It was the fourth time the Padres played at least 13 innings this season. They played a 22-inning game at home against Colorado on April 17-18, losing 2-1.

The last team to play a game of at least 22 and 17 innings in the same season was the 1989 Los Angeles Dodgers, who played two 22-inning games and a 17-inning game.

Scott Hairston started the winning rally with a one-out walk off Edinson Volquez (7-2), the second starting pitcher the Reds put on the mound in extra innings. Brian Giles reached on first baseman Joey Votto's two-out throwing error, moving Hairston to third. Gonzalez then hit a full-count pitch over the fence in straightaway center field for his 14th homer.

The game lasted 5 hours, 57 minutes. It was the third-longest game in Reds history.

Long after San Diego starter Greg Maddux was gone, Josh Banks (1-0) scattered five hits over six innings for the win.

Cincinnati went ahead three times in the late innings. The Padres tied it each time, twice on homers.

ROCKIES 4, METS 1: At Denver, Willie Randolph didn't get the pick-me-up he needed when New York lost to the Colorado Rockies, whose patchwork lineup included four recent call-ups. One of them, Seth Smith, hit his first major league homer, a three-run shot off John Maine (5-4) to back an impressive start by Aaron Cook (7-3). The right-hander allowed four hits, all singles, in his seventh career complete game and first since July 25. Awaiting New York's embattled manager back home Monday is a meeting with ownership amid speculation that his job is in jeopardy.

PHILLIES 15, ASTROS 6: At Houston, Chase Utley and Shane Victorino each had three RBIs for the Phillies, who finished with 16 hits after Houston's Chris Sampson allowed five through five innings.

Fernando Nieve (0-1), called up from the minors on May 16, gave up four hits and two runs without recording an out in the sixth and Utley hit a two-run homer off Dave Borkowski to cap a six-run seventh. Nieve was sent back to the minors after the game.

PIRATES 6, CUBS 5 (11): At Pittsburgh, Jason Bay beat the Cubs with an extra-inning single for the second day in the row, delivering a two-out line drive down the left field line in the 11th after Pittsburgh tied it on a dropped fly ball in the ninth. The Cubs appeared to have the game won when Nate McLouth lofted a fly ball close to the warning track in left with two outs in the ninth and Chicago up 5-4. But Alfonso Soriano lost the ball in the sun and it glanced off his glove, scoring pinch-runner Brian Bixler to tie it.

DIAMONDBACKS 9, BRAVES 3: At Atlanta, Eric Byrnes hit his first career grand slam to knock Tom Glavine out of the game and power the Diamondbacks past Atlanta.

MARLINS 8-5, GIANTS 6-4: At Miami, Dan Uggla hit a bases-loaded, two-out single in the ninth inning to give Florida a doubleheader sweep against San Francisco. Uggla also hit one of four homers for the NL East leaders in the opener. San Francisco's Omar Vizquel played his 2,584th game at shortstop, breaking the major league record previously held by fellow Venezuelan Luis Aparicio. Vizquel tied the record in the opener and received a standing ovation from the Marlins crowd when it became official after the fifth inning of the second game.

NATIONALS 7, BREWERS 6: At Washington, Elijah Dukes scored on Guillermo Mota's ninth-inning wild pitch, giving the Nationals a victory over Milwaukee.

DODGERS 4, CARDINALS 3 (10): At Los Angeles, Andre Ethier singled home the winning run in the 10th inning and Luis Maza hit his first big league homer, leading Los Angeles over St. Louis. Touted prospect Clayton Kershaw pitched six effective innings for the Dodgers in his major league debut, striking out seven.

American League

ATHLETICS 6, RED SOX 3: At Oakland, Calif., Jon Lester's hopes for another no-hitter ended with the first batter he faced, and the day never got better for the Boston Red Sox. Jack Hannahan hit that leadoff single and later drove in two runs, and Jack Cust hit a two-run homer as the Oakland Athletics completed a three-game sweep.

WHITE SOX 3, ANGELS 2: At Chicago, Carlos Quentin led off the ninth inning with his second homer off John Lackey (1-1), and Chicago beat Los Angeles to avoid a three-game sweep. Quentin also hit a two-run shot in the third. His AL-leading 14th home run made a winner of Scott Linebrink (2-0), who pitched a perfect ninth after Jose Contreras threw eight strong innings.

RANGERS 2, INDIANS 1: At Cleveland, right fielder Ben Francisco misplayed a simple single into a costly error in the 10th, enabling Jarrod Saltalamacchia to score from first base with the winning run.

YANKEES 6, MARINERS 5: At New York, Jose Molina hit a two-out RBI double to cap a four-run eighth inning, and the Yankees rallied for their fifth straight victory. The Yankees won consecutive series for the first time this season, while the Mariners have lost a season-worst six games in a row.

BLUE JAYS 3, ROYALS 1: At Toronto, Shannon Stewart drove in the go-ahead run on a fielder's choice, Dustin McGowan won for the first time in four starts and the Royals have now lost seven straight.

TWINS 6, TIGERS 1: At Detroit, Jason Kubel hit a tiebreaking grand slam with two outs in the eighth inning and Glen Perkins shut down Detroit's offense to take two of three in the series.

Carlos Guillen homered and finished with three hits for Detroit, which wasted a strong start by Justin Verlander after blowing out Minnesota 19-3 on Saturday night.

RAYS 5, ORIOLES 4: At St. Petersburg, Fla., Evan Longoria drove in the winning run with a double in the ninth inning, giving the Rays a three-game sweep of the Orioles.

Carlos Pena drew a one-out walk in the ninth off George Sherrill (1-1) and scored on Longoria's double to center.