Gray (1-2) was roughed up in his previous start but allowed just three hits on Sunday, including two homers. He retired 11 of his last 12 batters following Joey Gallo's solo homer in the fourth and ended his day with a strikeout of Derek Dietrich.
''I felt like I could live on the corner today,'' Gray said. ''I felt really fine in my command. Two bad pitches, but other than that we controlled it.''
The Rangers had the tying run at the plate in the ninth after two bases-loaded walks by Jairo Diaz but Carlos Estevez came on for his first save. Estevez was hit on the back of his right hand by Scott Heineman's line drive, but recovered and threw him out to end the game.
Manager Bud Black said Estevez would be sent for an X-ray.
''We'll see where we are after that,'' Black said.
Ryan McMahon homered and Trevor Story and Charlie Blackmon had two hits and two RBIs each to help the Rockies end a three-game skid.
Rougned Odor's two-run homer in the second inning put Texas ahead, but Colorado responded with a five-run second inning against Kolby Allard. Allard was nearly out of the inning without a run being scored but Odor's errant throw on a double-play grounder by Matt Kemp kept the second alive.
Raimel Tapia followed with a single in an 11-pitch at-bat and McMahon hit a three-run homer to give the Rockies the lead. A walk and three singles made it 5-2 and Tapia, who had three hits, drove home Kemp with a triple in the third.
''If we turn that double play, everything's different. Kolby battled, came out the next inning and fought through it. But it takes you down,'' Rangers manager Chris Woodward said. ''When your starting pitcher has to throw 40 pitches in an inning it's pretty much game over at that point. It was a good lesson for us. We have to finish those plays off, we have to finish these innings off, because this is what happens.''
All six runs against Allard (0-1) came with two outs, and the left-hander's ERA jumped from 1.00 to 5.25 after his first Coors Field start.
Colorado tacked on two runs in the fourth and two more in the fifth to reach double digits for the first time this season.
''We hit a little rough patch but our team is resilient. We're hungry and we're still having fun,'' said Kemp, who scored three runs. ''The past three or four days haven't gone as planned but we're still right there, still in the mix.''
Rangers: Activated OF Danny Santana (right forearm strain) from the 10-day injured list and placed LHP Brett Martin (left rotator cuff inflammation) on the 10-day IL, retroactive to August 13.
Rockies: INF Chris Owings missed his third straight game with left hamstring tightness. Black said Owings ran at ''about 75 percent'' Saturday and was going to increase the percentage Sunday. Owings took grounders in the field Saturday and hit in the cage and during batting practice.
David Dahl has overcome injury to become an All-Star, and now has to overcome another problem - a prolonged slump.
Dahl was one of four Rockies on the NL All-Star team last year but has struggled this season. He is hitting just .194 in 18 games and was out of the lineup for the second straight game Sunday. Dahl is hitless in his last five games but Black isn't worried about him.
''David's a great talent and eventually he's going to come out of it, as a lot of great players too,'' Black said. ''He hasn't really been through this type of stretch before, as a big-leaguer or minor leaguer. It's a short season, and you can ill-afford to go into any prolonged funk. He'll get through this.''
Rangers: RHP Jordan Lyles (1-1, 6.06) takes the mound in the first of a two-game home series against San Diego.
Rockies: LHP Kyle Freeland (2-0, 2.45) will open a two-game series at Houston on Monday.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Copyright 2022 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.