SAN DIEGO (AP) -- Coming off a deflating loss to the NL West-leading Arizona Diamondbacks , San Francisco Giants manager Bruce Bochy wanted to see signs that the defending World Series champions hadn't packed it in.
Pablo Sandoval homered twice, lefty Madison Bumgarner struck out a career-high 13 in 8 1-3 innings and the Giants beat the last-place San Diego Padres 7-2 on Monday to remain seven games behind the Diamondbacks with 21 to play.
The Giants came into this three-game series with their biggest deficit of the season after losing two of three to the Diamondbacks in a weekend series, including a 4-1 loss on Sunday.
"I'm proud of how the guys bounced back," Bochy said. "They played so well today. I mean, that's as tough a loss as we've had all year. We played one of our better games. We did a great job of putting that game behind us."
The Diamondbacks won 10-7 at Colorado on Monday.
Bumgarner (10-12) came within two outs of his first career complete game. He was pulled after Nick Hundley hit a solo homer with one out in the ninth, his sixth. Bumgarner held San Diego to two runs and seven hits, and walked one. It was the fourth time he struck out 10 or more, all coming this season.
"What a job he did," Bochy said. "I said, 'I'm going to let him start the ninth, give him a chance, get a shot at it.' He had a couple deep counts and the home run. I wasn't going to let him work that hard to get the complete game."
Bumgarner allowed a run in the first inning but then dominated the Padres after that.
"They hit some good pitches and got a run in, then I shut them down," Bumgarner said. "Our defense made a lot of great plays."
Sandoval's 17th and 18th homers, both off Tim Stauffer (8-12), were enough to carry the Giants to just their third win in eight games. With two outs in the first, he homered into the sand play area beyond the fence in right-center on a 2-0 pitch. He led off the fourth with a shot into the right field seats on a 2-1 pitch.
"Those balls were well-hit," Bochy said. "He's strong. It doesn't matter what park he's in, he hits them well. He gave us what we needed. He got us on the board there early. Good day for him."
The Giants have hit seven homers in their last five games after going homerless in their previous six.
Sandoval's first homer, to one of the deepest parts of spacious Petco Park, was estimated at 436 feet.
"It's not that easy, especially in this park," Sandoval said. "It's tough to hit home runs so I don't try to hit home runs."
It was the third time Sandoval has had two homers in a game. The first two were in 2009.
"The pitches today were pitches that were middle of the plate and missed locations," Stauffer said.
Sandoval flied out to left in his third at-bat. In his fourth at-bat, with runners on first and third, first base opened on a wild pitch by Jeff Fulchino while Sandoval was batting, and he was intentionally walked. After a forceout at home, Cody Ross hit a two-run double. Brad Brach , the third Padres reliever that inning, walked pinch-hitter Mark DeRosa with the bases loaded to run San Francisco's lead to 7-1. The Padres walked four that inning.
Sandoval struck out in the ninth inning.
Stauffer lost his third straight start. allowed four runs and seven hits in six innings, struck out one and walked one.
In his previous start, Stauffer lasted only 1 2-3 innings and had a career-high seven walks in an 8-5 loss at Dodger Stadium. Six of them were in the second inning alone, three with the bases loaded.
"He's not working himself out of jams," San Diego manager Bud Black said. "A little bit of the long ball has gotten to him. He's not stringing good pitches together."
San Diego's Jesus Guzman hit an RBI single in the first.
NOTES: Giants RF Carlos Beltran was scratched from the lineup. Manager Bruce Bochy said he had either serious food poisoning or the flu and was sick all night. ... The Padres reinstated OF Chris Denorfia from the 15-day DL before the game. Denorfia had two doubles. ... Giants LHP Eric Surkamp (0-0, 1.50 ERA) will make his second career start on Tuesday night. The Padres will counter with LHP Wade LeBlanc (2-4, 5.14).