TUCSON, Ariz. (AP) -- Southern California receiver Marqise Lee broke free from Arizona's defenders time and again, racing his way into the Pac-12 record book. Matt Barkley had a pretty good day of his own, throwing for nearly 500 yards.
It still wasn't enough for the Trojans to overcome all of their mistakes.
Lee had 16 catches for a Pac-12-record 345 yards and two touchdowns, but No. 10 Southern California couldn't escape five turnovers and more than 100 yards of penalties in a 39-36 loss to Arizona on Saturday.
"The mistakes were discouraging, but we were able to overcome them on the scoreboard," USC coach Lane Kiffin said. "We had the lead, and I thought we might put it away. We gave them too many chances."
Lee had a huge day for USC (6-2, 4-2 Pac-12), eclipsing the Pac-12 record for receiving yards by halftime and finishing with 469 all-purpose yards after a couple of big kick returns.
Barkley put up big numbers, too, matching Carson Palmer's school record for 400-yard games with his third. He threw for 493 yards and three touchdowns on 31-of-49 passing.
USC finished with 618 total yards and pulled within three points on Silas Redd's 10-yard touchdown in the fourth quarter, but couldn't overcome the turnovers -- two on interceptions by Barkley -- and 13 penalties for 117 yards.
The Trojans had a final chance, but Barkley's last-ditch heave was swatted down, leaving them stuck on 799 wins as a program while putting a big dent in their national championship hopes.
"From here, we've just got to stick together," Barkley said. "That's the beauty of football; you experience some of the most spurring moments of your life and you learn to cope with the moments like these."
The Wildcats (5-3, 2-3 Pac-12) had come up short in close games during their first season under coach Rich Rodriguez and appeared to be headed toward another disappointment as Lee repeatedly ran past them.
Quarterback Matt Scott wouldn't let Arizona come up short again.
The fifth-year senior ran for 100 yards and got Arizona's comeback started with a 10-yard touchdown run late in the third quarter. He threw for 369 yards, 259 of that on 10 catches by Austin Hill, and finished 27 for 50 passing.
Scott capped his day with his third touchdown pass, a 7-yarder to David Richards that put Arizona up 39-28 with just over five minutes left. He was wobbly and unable to play on Arizona's final possession after taking a hard hit, but had already done enough to give the Wildcats their biggest win under Rodriguez.
"Matt is a warrior," Hill said.
USC won last year's shootout 48-41, surviving Arizona's second-half comeback thanks to Barkley's school-record 468 yards and four touchdowns passing.
The Trojans spent the first half of the rematch trying to get out of their own way.
Barkley threw his two interceptions -- and nearly several others -- and overthrew tight end Xavier Grimble in the end zone on a fourth down. Redd also lost a fumble in the first half, and safety Jawanza Starling lost a fumble on an interception return.
USC also had eight penalties for 79 yards in the first half, including a taunting call against safety T.J. McDonald that extended Arizona's opening drive. Scott capped that by hitting Johnny Jackson on an 8-yard touchdown pass.
Arizona had a few discipline problems, too.
The Wildcats had a 1-yard touchdown run by Ka'Deem Carey wiped out by a holding call, and John Bonano pushed a 37-yard field goal wide right after another hold erased his make from 27 on the first half's final play.
USC shook off its mistakes behind some big plays in the first half by Barkley and Lee.
Barkley connected with Grimble on a 12-yard touchdown early in the second quarter, then found Lee late, hitting him in stride for a 49-yard touchdown that put the Trojans up 14-10.
Lee kept getting open and Barkley kept finding him, setting up a 3-yard touchdown run by D.J. Morgan that put the Trojans up 21-13 late in the second quarter.
Lee had 12 catches for 255 yards in the first half and opened the second with a 44-yard touchdown catch to put USC up 28-13 and break the Pac-12 record of 293 yards receiving set by Oregon State's Mike Hass against Boise State in 2004.
"His performance was unbelievable," Barkley said. "We all know he's a special player, but to play like that and to have a game like he had tonight is really something."
It just wasn't enough against Arizona and Scott, who ran for a touchdown and threw for two more after the midpoint of the third quarter to lead Arizona to a season-defining victory.