AMES, Iowa (AP) With a chance to finish off the surprisingly tough Jayhawks, Iowa State coach Matt Campbell put the game in sophomore quarterback Brock Purdy’s hands.

Purdy made Campbell look like a genius, closing the door on Kansas with a fourth-down touchdown pass with 1:09 left.

Purdy threw for 372 yards and four TDs - including the game-clinching one on fourth-and-goal from the 4 - and Iowa State rallied to beat Kansas 41-31 on Saturday and clinch its third straight winning season.

“Like I told our seniors, it was fitting that guts, toughness (and) heart was the way we were able to win,” Campbell said. “We didn't play great. I'm not going to sugarcoat that in any way, shape or form.”

La’Michael Pettway had 96 yards receiving and two touchdowns for the Cyclones (7-4, 5-3 Big 12), who’ve now complied three consecutive winning years just twice in the modern era. Iowa State, under coach Earle Bruce, won eight games each in 1976, 1977 and 1978 before Bruce bolted for Ohio State.

But the Cyclones nearly blew it against the league’s last-place team.

Kansas (3-8, 1-7) scored two touchdowns in just 77 seconds late in the third quarter, the second coming after Purdy threw an interception, to jump ahead 24-21.

Purdy responded with a 24-yard TD pass to Breece Hall, and he ran for a five-yard touchdown with 5:10 left to put Iowa State back on top 34-31.

After stopping Kansas on fourth down at the Iowa State 37, the Cyclones could have either kicked the chip-shot field goal and made it a six-point game - with Kansas out of timeouts - or go for it all.

Campbell went for the kill, and Purdy scrambled away from danger until Shaw could get open for the score that sealed Iowa State’s fifth straight win over Kansas, a 24-point underdog entering play.

“They made one more play than we did, certainly at the end,” Kansas coach Les Miles said.

Carter Stanley threw for 328 yards and three TDs for Kansas, and Pooka Williams ran for 154 yards.

“Sick, frustrated,” Williams said of the vibe in the KU locker room. “But I feel like we have a chance...against every team we play.”

THE BIG PICTURE

Iowa State: The Cyclones’ defense, which has been really good for most of the season, had one of its worst games in years. Iowa State allowed 493 yards and nine third-down conversions. But the Cyclones had Purdy, who has blossomed into one of the nation’s best this season. “When this team has needed him the most, he’s been his best,” Campbell said.

Kansas: The Jayhawks also went for a huge gamble late, going for it on 4th-down-and-5 with 4:18 left down by three. It didn’t work, as Stanley threw a ball over the middle and behind the sticks that Anthony Johnson swatted away. Still, Kansas can take solace in knowing it threw the ultimate scare into a program whose ascent the Jayhawks will look to emulate in the years ahead. “I would rather have had the ball in our hands than in their hands. So the opportunity to go for it on fourth down when your quarterback is hot and the opportunity to keep that possession, keep the ball in our hands was just what I wanted to do,” Miles said of his decision to go for it.

PIVOTAL MOMENT

The Cyclones let Kansas drive 85 yards on its final possession of the first half, which was reminiscent of the 75-yard, 30-second TD drive Texas had to close out the second quarter last week. But Iowa State held KU to a field goal and then a three-and-out to open the third quarter, and Purdy’s 4-yard TD toss to Pettway less than three minutes later made it 21-9. That sequence got lost in the madness that ensued, but the Cyclones likely don’t win the game without such a response.

THE NUMBERS

Breece Hall ran for 97 yards. ...Andrew Parchment caught eight passes for 86 yards, and Stephon Robinson had 75 yards receiving - including a 40-yard TD with 10:42 to go that put Kansas back on top 31-27. ...Iowa State finished with 489 yards and scored on all four of its trips to the red zone. ...The Cyclones were 10 of 16 on third down. ...Liam Jones hit field goals of 36, 37 and 30 yards for Kansas. But the result might have been different in the Jayhawks could have punched it in instead on any of those drives.

UP NEXT

Iowa State plays at Kansas State on Nov. 30.

Kansas hosts Baylor next Saturday.

---

More AP college football: https://apnews.com/tag/Collegefootball and https://twitter.com/AP-Top25

Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.