Updated

ARLINGTON, Texas -- €“ The Texas Rangers didn't need Colby Lewis to be perfect to make up for his last three rough outings Friday night.

The veteran right-hander nearly was though, carrying a perfect game into the eighth inning as the Rangers opened a 10-game homestand with a 4-0 win over Oakland.

Lewis had allowed 15 earned runs and 23 hits in his last three starts, losing all three decisions. That wasn't the Lewis that was baffling the Oakland hitters Friday though, as he needed just 69 pitches and two sterling defensive plays behind him to flirt with history into the eighth inning.

The chance at perfection ended on the second pitch of the eighth inning as Oakland's Danny Valencia lined a 0-1 pitch to left for a double. While the perfect-game bid ended there, Lewis kept the shutout intact by striking out two of the next three batters before exiting the field to a standing ovation.

He allowed a hit in the ninth, but came back and completed the shutout to notch his career high 15th win. It capped a historic night that Lewis didn't think would happen.

"I just wanted to go out there and have a good game," said Lewis, who struck out four and threw just 97 pitches for his third career shutout. "The stuff wasn't special in the pen or nothing like that. Nothing was really different than any other night. I was just able to get quick outs."

It was the longest a Texas starter had carried a perfect game since Yu Darvish went 8 2/3 perfect innings before allowing a single to Houston's Marwin Gonzalez on April 2, 2013. He also became the first right-hander to have a shutout on two innings or less in Arlington since Nolan Ryan had a no-hitter against Toronto on May 1, 1991.

In typical Lewis fashion though, he said he was thinking more about the Rangers winning than his perfect opportunity. He wasn't even too upset when Valencia lined a slider to left.

"I don't look at myself as having no-hitter or perfect-game stuff," he said. "I was like 'Whatever. It is what it is.' You still have to do your job. I don't throw 97 mph or have devastating stuff."

Valencia tipped his cap to Lewis when he reached second base and relished the fact that he had broken up the Lewis chance at history.

"I'd be lying if I said you don't want to be the person to break it up," Valencia said. "You almost want to be the villain in that situation, especially in front of their home crowd, but we're still trying to win games."

Lewis had just two strikeouts in the first seven innings but he rarely fell behind hitters and the defense kept his perfect intact.

Centerfielder Delino DeShields ended the fourth inning by charging in and making a diving catch off the bat of Josh Reddick. After breezing thought the fifth, Rougned Odor kept the perfect game run going in the sixth inning.

Oakland catcher Max Muncy hit a soft liner to right field that Odor ran out and made an over-the-shoulder catch on.

The Rangers, who had been shut out in their last two games, gave Lewis some runs to work with in the first inning. Mitch Moreland laced a two-run double into the corner in right and Odor followed with a double to left.

That was more than enough for Lewis.

"He had everything going tonight," Texas catcher Chris Gimenez said. "This was definitely one of those nights where that (a perfect game) easily could have happened. Unfortunately we lost it in the eighth but ultimately we got what was most important."

MORE FROM FOX SPORTS SOUTHWEST:

- PHOTOS: Cowboys Cheerleaders Auditions

- Ranking NFL quarterback salaries

- Highest paid player on every NFL team

- College football's biggest video boards