Petit set down the first eight Colorado hitters he faced Thursday, setting the record by striking out Charlie Culberson and drawing a standing ovation at AT&T Park. That broke the mark held by Mark Buehrle of 45 in a row for the Chicago White Sox in 2009.
"I think it's like a reward for all the work I have put into my pitching," Petit said through a translator.
The streak ended when the next batter, Rockies pitcher Jordan Lyles, doubled to left field.
"I was a little nervous when the hitters were advancing toward the record. But in that pitch to the pitcher, I was not nervous," Petit said. "I was doing my job. The first pitch was fine. The second pitch was fine, too, but it slid a little bit where I didn't want it to."
Petit went on to pick up the win in a 4-1 victory over the Rockies.
Petit's string covered eight games, six of them in relief. He also surpassed Jim Barr's National League record of 41 in a row with the Giants in 1972.
The 29-year-old journeyman from Venezuela fell one out shy of a perfect game against Arizona last September, with Eric Chavez wrecking Petit's shot at baseball lore with a single.
"I think God gave me a second opportunity, and I said to myself, 'He's giving me another opportunity. This time, I'm not going to allow myself to not do it,'" Petit said.
Petit (4-3) made this start in place of struggling Tim Lincecum, who was available out of the bullpen. Petit allowed four hits, struck out nine and walked none, pitching out of the stretch the entire game.
Giants manager Bruce Bochy said he will weigh his options but admitted it will be hard to take Petit out of the rotation.
"What a roll to get on to have that kind of record," Bochy said. "As long as this game's been going on, now he's got it."
The Associated Press contributed to this report.