SAN FRANCISCO — One strike shy from a perfect game last September, Yusmeiro Petit refused to let another chance at baseball history slip away.

Petit set a major-league record when he retired his 46th batter in a row, and the San Francisco Giants beat the Colorado Rockies 4-1 on Thursday for their third straight win.

“I think it’s like a reward for all the work I have put into my pitching,” Petit said through a translator. “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 (4-3) got the first eight hitters, establishing the mark by striking out Charlie Culberson. That broke Mark Buehrle’s record of 45 straight with the Chicago White Sox in 2009.

The announced sellout crowd of 41,017 at AT&T Park gave Petit a standing ovation after he fanned Culberson. The string ended two pitches later when the next batter, Rockies starter 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.”

Notes

• New York Yankees star Masahiro Tanaka threw 49 pitches in a simulated game and did not report any unusual pain as he recovers from a partial tear of the ulnar collateral ligament.

• Phillies president and CEO David Montgomery is taking a leave of absence as he recovers from jaw-cancer surgery and will be replaced by former general manager Pat Gillick, who was Mariners GM from 2000-03.

• Kansas City claimed infielder Jayson Nix off waivers from Pittsburgh.