CHAMPAIGN, Ill. (AP) -- Quarterback Curtis Painter ran for two touchdowns and threw for another as Purdue rallied for a 42-31 victory over mistake-prone Illinois on Saturday.
The Boilermakers (7-4, 6-3 Big Ten) trailed by nine points in the third quarter before defensive end Alex Magee led a defensive charge that turned around the game.
Magee, who recovered a fumble by Juice Williams in the end zone for a second-quarter TD, intercepted a pass in the third quarter and forced a fumble in the fourth quarter to set up touchdowns.
Illinois (2-9, 1-6), who gave No. 1 Ohio State a scare in a seven-point loss a week ago, lost its sixth straight game.
The Illini turned the ball over four times in five plays during their second-half collapse, and Purdue scored touchdowns off three of the miscues after trailing 23-14.
Painter ran 42 and 18 yards for TDs in the second half and wide receiver Dorien Bryant caught a 20-yard touchdown pass to give Purdue a 28-23 lead with 2:02 left in the third quarter. Bryant also scored on a 6-yard run early in the fourth quarter.
Painter was 20-for-49 for 229 yards with a touchdown and interception, and ran for 54 yards. Bryant caught nine passes for 120 yards and a touchdown. Purdue had 431 yards of total offense.
The Boilermakers forced a season-high five turnovers. Defensive end Cliff Avril tipped a pass and recovered a fumble in the second half.
Williams, Illinois' freshman quarterback, rushed for a career-high 145 yards on 22 carries and scored his first touchdown on a 20-yard run to cap a 12-play, 80-yard drive on the first series of the game.
Illinois running back Pierre Thomas rushed for 105 yards on 10 carries and a touchdown as the Illini finished with 316 yards rushing.
Illinois Jason Reda made field goals of 38, 29 and 30 yards. Illinois led 16-14 at half.
Kory Sheets' 3-yard touchdown run in the first quarter capped an 11-play, 73-yard drive for Purdue's first score.
Williams fumbled in the end zone after being sacked by Purdue's Anthony Spencer early in the second quarter. Magee fell on the ball for the score to give Purdue a 14-10 lead.