Updated

Pablo Sandoval broke out of a power slump with three home runs, and the San Francisco Giants hit a Petco Park record six as a team in thrashing the San Diego Padres, 13-5, to avoid a series sweep.

Sandoval ended 4-for-5 with six RBI, three of them coming on his last home run in the ninth. He had never hit three home runs in a regular season contest before and had entered play Wednesday with just two in his last 73 games.

Hunter Pence and Hector Sanchez each clubbed two-run shots, while Brandon Crawford added a solo homer.

Tim Lincecum (9-13) returned to the site of his no-hitter, and while he wasn't nearly as effective, the offensive power explosion propelled him to the win. He gave up gave up five runs, seven hits and four walks over 5 2/3 frames,

Dropping a sixth straight decision, Eric Stults (8-13) was tattooed for seven runs on nine hits over 4 2/3 frames. He served up three of the home runs.

"He still feels physically good," said Padres manager Bud Black about his starter. "He'll probably be the first to tell you, he's not making pitches. He's not showing any signs physically of being weary."

Ronny Cedeno homered in the second to give San Diego a 2-0 cushion, but the Giants began to counter with home runs in bunches.

Brandon Crawford knocked one off the foul pole in right to begin the third, and Stults served up two more longs balls an inning later when Pence and Sanchez each crushed two-run shots to stake the Giants to a 5-2 lead.

Pence added to his RBI total in the fifth, chasing Stults from the game with a two-out double over the head of Reymond Fuentes in center. Sandoval then sent a blast over the wall in right off reliever Brad Brach for an 8-2 margin.

Sandoval then put the game away with a solo shot in the eighth, and for good measure, clubbed a three-run blast in the ninth three batters after a Juan Perez RBI single, giving the Giants a 13-5 lead.

Lincecum threw 148 pitches without giving up a hit during his last appearance at Petco Park, but had his first offering on Wednesday singled to center by Will Venable, who later came in to score on a passed ball.

The Padres had a chance to tack on more in the first when they loaded the bases with one out, but Lincecum struck out Nick Hundley and Fuentes to escape further trouble.

After Cedeno's homer, Lincecum wasn't touched up again until the fifth, when Chase Headley belted a solo homer to right. The righty was then lifted in the sixth with two down after walking his second batter of the inning.

Jose Mijares came in but was unable to get the last out, with Venable and Alexi Amarista plating a run each. Jean Machi came in from the bullpen, though, and kept the Giants ahead, 8-5, by fanning Jedd Gyorko.

Game Notes

The only other time Sandoval hit three home runs in a game was last October, during Game 1 of the World Series ... Lincecum moved to 7-3 lifetime at Petco Park ... The Giants' previous high this season for home runs in a game was three ... Headley hit his first homer at Petco Park since June 11.