Freshman Brett Hundley, playing a few miles from where he grew up, drove the Bruins (6-2, 3-2 Pac-12) into field-goal range after Taylor Kelly's 7-yard touchdown pass to D.J. Foster put the Sun Devils (5-3, 3-2) ahead 43-42 with 1:33 to play.
Hundley completed 19 of 31 for 274 yards and four touchdowns. Johnathan Franklin rushed for 164 yards, leaving him 20 yards shy of the UCLA career rushing record.
Damien Thigpen put UCLA ahead 42-33 with his second TD pass of the day from Hundley, a 20-yarder with 9:01 to play.
But the Sun Devils scored the next 10 to regain the lead.