An older, wiser version of the former Arizona right-hander was on the mound against his old team on Sunday, and for the second straight start since he was called up from the minors, Petit was in control.
Hunter Pence homered, doubled and singled, driving in two runs and scoring three times as the Giants improved to 10-5 against Arizona this season.
But the story for San Francisco was Petit.
"I'm not going to say surprised, I'm going to say I'm happy for him," Pence said. "He's just gets his work done. He's done everything the right way. He's a good guy to have around the clubhouse. He's positive. He has tremendous command, he's got a couple of off-speed pitches to keep them honest, and it's been fun playing behind him."
Patrick Corbin (13-5), pitching on an extra two days' rest, allowed five runs on nine hits in five innings to fall to 1-4 in his last seven starts.
Petit (2-0), who pitched for the Diamondbacks from 2007-09, went six-plus innings, allowing two runs on seven hits in his first career start against Arizona. He also singled in a run, his second career RBI.
Petit was making his second start since being called up from Triple-A Fresno. He gave up two runs on six hits in six innings in a 5-3 win at Colorado on Tuesday.
"He's come up here and done all that we could ask for," Giants manager Bruce Bochy said.
Petit's previous career high in strikeouts was eight on three occasions, most recently July 29, 2009, while pitching for Arizona against Philadelphia. He said he's a "completely different" pitcher than he was in those days.
"Experience," he said with a teammate serving as translator. "Before I wasn't consistent with what I was doing. Now the experience is taking place in what I'm showing right now."
Arizona manager Kirk Gibson said Petit "is a little bit more mature" than he was in his days with the Diamondbacks.
"He had a good plan today and he hit his spots," Gibson said. "When you hit your spots with that much regularity it makes it tough."
San Francisco won its fourth consecutive series over the Diamondbacks overall and fifth series in a row in Arizona. The Diamondbacks last won a series at home against the Giants April 6-8, 2012.
The extra rest didn't do much good for Corbin. In his last two outings, the young left-hander has given up 14 runs, 13 earned, on 16 hits.
"I felt all right," Corbin said. "I just wasn't really locating anything and left some pitches up."
San Francisco scored three times with two outs in the fourth inning.
Buster Posey led off with a single, then Pence doubled to put runners at second and third. Pablo Sandoval flew out to right and Brett Pill grounded out to third and it looked as if Corbin might escape. But Sanchez doubled to left-center to bring both runners home and make it 3-1. Gregor Blanco's infield single put runners at first and third, then Petit's single to right put the Giants up 4-1. It was Petit's fourth career hit in 69 at-bats.
Pence's opposite-field home run on Corbin's full-count pitch with two outs in the fifth boosted the lead to 5-1.
Arizona scored first in the opening inning when Adam Eaton singled and scored from first on Martin Prado's two-out double. San Francisco tied it in the second. Pence drew a leadoff walk, advanced to third on Sandoval's single and scored on Sanchez's ground out to short.
Petit left after giving up a leadoff single to A.J. Pollock in the seventh. Left-hander Jose Mijares got Gerardo Parra to fly out, then struck out pinch-hitter Tony Campana. Willie Bloomquist singled to put runners at first and second, then Eaton's RBI single cut the lead to 5-2. Right-hander Santiago Casilla relieved Mijares and, on the first pitch, Paul Goldschmidt flew out to center to end the inning.
Posey doubled in two runs off and Pence had an RBI single off Heath Bell in the ninth.
The Giants activated 2B Tony Abreu off the 15-day DL. Abreu missed 31 games with bursitis in his left knee. ... The Diamondbacks recalled two relievers from Triple-A Reno, right-hander David Hernandez and left-hander Tony Sipp. ... The Diamondbacks open a three-game series against Toronto on Monday night, with right-hander Brandon McCarthy (3-8, 5.03 ERA) going for Arizona and right-hander Esmil Rogers (3-7, 5.03) on the mound for the Blue Jays. It's the Diamondbacks' final interleague series of the season. ... San Francisco goes to San Diego for a three-game series, with Barry Zito (4-10, 5.81) starting for the Giants and Ian Kennedy (5-9, 5.10) for the Padres. ... Arizona acquired minor league RH reliever Matt Langwell from Cleveland to complete the Jason Kubel trade to the Indians.