DALLAS (AP) Emotionally and physically spent just a few minutes earlier, Baker Mayfield found the energy to gallop into the Cotton Bowl tunnel joyously, ''Golden Hat'' trophy on his head, after beating his hometown Texas Longhorns again.

Mayfield threw 59 yards to Mark Andrews for the go-ahead touchdown in the fourth quarter after Oklahoma had blown a 20-point lead, and the 12th-ranked Sooners held on to beat Texas 29-24 on Saturday.

Mayfield's second TD throw of more than 50 yards came 68 seconds after freshman quarterback Sam Ehlinger ran 8 yards to give the Longhorns their first lead after trailing 20-0 in the second quarter.

An Austin native who grew up often wearing Sooner gear, Mayfield came back after slowly leaving the field at the end of a second-half series, appearing to favor his right arm.

He didn't miss a play, and the decisive throw was perfect to Andrews running free down the sideline on the Texas side of the half-burnt orange, half-crimson Cotton Bowl in the middle of the Texas State Fair.

''For the older guys that were around here and got nicked up, it's realizing it's your last one,'' said Mayfield, a fifth-year senior and former Texas Tech walk-on who threw for 302 yards and two scores. ''You'll fight through a little extra pain. It was a mental decision for all of us.''

The win kept the playoff hopes alive for the Sooners (5-1, 2-1 Big 12) a week after a stunning home loss to Iowa State when they were ranked third with a nation-leading 14-game winning streak and had a 24-10 lead at halftime.

''The thought of the College Football playoff is not what's going through your head right there,'' Mayfield said about the moment when the Sooners were trailing 24-23. ''It's about doing your job and winning that game and beating Texas.''

Lincoln Riley, the youngest FBS head coach at 34, topped Tom Herman in the first Texas-OU matchup since 1947 with both coaches leading their teams for the first time. Bud Wilkinson, who led the Sooners to three national titles, was the losing coach in that game.

''I felt the strong sense to want to win this game the other two times as an offensive coordinator,'' said Riley, who held that job before Bob Stoops' surprising retirement in June. ''My job has changed. I get that. But my sense of responsibility to do my part for this team hasn't.''

Ehlinger, the second straight freshman to start against Oklahoma for Texas (3-3, 2-1), had to be replaced by last year's starter, Shane Buechele, on the drive after the Sooners went back in front.

After going to the pop-up medical tent when he went down hard on his right shoulder and helmet on the Texas sideline, Ehlinger returned five plays later. He said it was a precautionary check for a concussion.

The series ended on downs, and a final possession that started on the Texas 4 with 49 seconds left ended near midfield on a desperation lateral play, clinching an OU win that looked to be a blowout but ended up being the fourth straight decided by seven points or fewer.

''The atmosphere was incredible,'' Ehlinger said. ''Losing the game is not incredible. I'm looking forward to the next three years.''

THE AUSTIN BOYS

Ehlinger, a huge Texas fan while also growing up in Austin and attending one of Mayfield's rival high schools, threw for 278 yards and a touchdown and ran for a game-high 106 yards. ''He's a tough kid,'' Mayfield said. ''You can tell by the way he carries himself. He bounces back up after getting hit. Just how Austin boys do it, I guess.''

SOONER SCORING

Mayfield opened the scoring with a 54-yard pass to Jeff Badet, who was waiting in the end zone to make the catch as trailing safety Kris Boyd waved fruitlessly at the ball. Oklahoma's Trey Sermon had 96 yards rushing and a 42-yard pass on a trick play that set up one of Austin Seibert's three field goals.

HERMAN'S FIRST

Herman, who won his other meeting with Oklahoma as Houston's coach in last year's opener, was a graduate assistant at Texas under Mack Brown in 1999 and 2000. ''I don't know that you have time to soak it all in or reminisce or anything like that,'' he said. ''But it is a really unique college football experience.''

THE TAKEAWAY

Oklahoma: The Sooners had a school-record streak with at least 30 points stopped at 15 games, but that doesn't matter much. Each of the past three years, Oklahoma has lost at least once in the first five games. And the past two seasons, they haven't lost again in the regular season on the way to a final ranking of fifth.

Texas: The Longhorns stayed close with a defense that settled down after giving up 179 yards passing to Mayfield in the first quarter, and a couple of penalty-aided touchdown drives that finally got them within a score early in the fourth quarter. The ninth interception of the season for the Texas defense, leading to a first-half field goal, was the first off Mayfield.

UP NEXT

Oklahoma: At Kansas State next Saturday.

Texas: Home against No. 14 Oklahoma State next Saturday.

---

More AP college football: http://collegefootball.ap.org and https://twitter.com/AP-Top25

Copyright 2017 by STATS. Any commercial use or distribution without the express written consent of STATS is strictly prohibited.