BLOOMINGTON, Ind. -- Trace McSorley and No. 18 Penn State kept it simple to snap a two-game losing streak.
"We just took what was there," McSorley said.
McSorley passed for 220 yards, ran for 107 and had a hand in three touchdowns in Penn State's 33-28 victory over Indiana on Saturday.
Penn State (5-2, 2-2 Big Ten) rallied after Indiana (4-4, 1-4) took a 21-20 lead in the third quarter on Steve Scott's 3-yard touchdown run.
Johnathan Thomas took the ensuing kickoff back to the Indiana 5, setting up McSorley for the go-ahead touchdown on the next play.
Brandon Wilson partially blocked the extra point, leaving Penn State's lead at 26-21. Indiana forced Penn State to punt on the Nittany Lions' next drive, but J-Shun Harris fumbled the punt return and turned the ball over. Five plays later, McSorley nearly walked into the end zone to make it 33-21 lead.
"Every time it seemed like we had the game in control and were able to put them away, they would battle back," Penn State coach James Franklin said. "We'll take this win, go back and watch the film, make corrections and get better."
The Hoosiers added a late touchdown Peyton Ramsey's 21-yard pass to Harris, and recovered an onside kick. Michael Penix and Ramsey split snaps for the Hoosiers, combining for 330 passing yards and a touchdown. Scott led Indiana in rushing with 138 yards and two touchdowns.
"Just a gut-wrenching loss for our team today. I thought our kids played their hearts out," Indiana coach Tom Allen said. "Proud of the effort. Just have to play better in certain situations and times, in critical moments."
Miles Sanders ran for 72 yards and a touchdown for Penn State.
Penn State: The Nittany Lions avoided stumbling at Indiana in what could easily be viewed as a trap game. Having lost two straight, Penn State simply couldn't afford to lose this one when considering the next three opponents on the Nittany Lions' schedule -- Iowa, Michigan and Wisconsin.
Indiana: The Hoosiers missed an opportunity to secure one of two more wins needed to become bowl eligible for the first time since 2016.
Penn State: Host Iowa next Saturday.
Indiana: At Minnesota next Saturday.
More AP college football: https://apnews.com/tag/Collegefootball and https://twitter.com/AP-Top25