Arizona had been able to get way with occasional nights when the 3-pointers and free throws were not falling.

Even with the kind defense the Wildcats play, it wasn't enough against their biggest rival.

Second-ranked Arizona kept Arizona State close with its defense, but couldn't overcome another poor shooting night in a 69-66 loss to the Sun Devils on Friday.

Arizona shot 4 of 16 from 3-point range and 16 of 30 on free throws, negating a 54-35 advantage in rebounds, including 18 on the offensive glass.

"Our offense is continuing to put more and more pressure on our defense," Arizona coach Sean Miller. "You can only guard so well."

With both teams struggling offensively all night in a physical game filled with fouls, neither team could take control.

Arizona State (19-6, 8-4 Pac-12) won it by turning to Jermaine Marshall and relying on Jordan Bachynski.

Marshall, who missed the first game against Arizona, went over 20 minutes without a field goal, but made a pair of 3-pointers in the second overtime, then scored on a drive with 14 seconds left to put the Sun Devils up 67-66. He had eight of his 29 points in the second overtime.

Arizona (23-2, 10-2) didn't call a timeout and got the ball into the hands of McConnell for a final shot. The Wildcats' point guard hit some big shots throughout the game, but his final attempt was sent back by Bachynski, leading to a breakaway dunk by Jahii Carson that sent the fans pouring onto the court.

One problem: There was still time left on the clock. Less than a second, but enough for the Wildcats to get off a good shot.

Nick Johnson got a good one, too. It hit the rim and bounced away, though, sending the fans back onto the court and the Sun Devils to victory over Arizona, the highest-ranked opponent they have ever beaten at home.

"In terms of college basketball, that's as good as it gets," said Arizona State coach Herb Sendek, who was doused with Gatorade in the locker room. "Obviously, the game could have gone either way, but I stand in awe at the players on both teams and their ability to perform on a stage like that, in such conditions, they really have my total respect."

Arizona won the first game over Arizona State in a rout and its first two games without injured forward Brandon Ashley.

The Wildcats tried to eke out another victory behind their defense, but came up short behind poor perimeter shooting and from the free-throw line.

McConnell led Arizona with 17 points and five rebounds. Kaleb Tarczewski had 13 points and 13 rebounds, and Aaron Gordon added 13 points and 10 rebounds for the Wildcats, who shot 35 percent overall.

"We missed a ton of free throws, heck we've missed a ton of free throws all year," Miller said. "Eventually, that's going to run its course and we're going to lose because we're leaving too many points on the table."

Arizona State had been on a roll since losing by 23 points in Tucson on Jan. 16, winning five of its past six games to get back into the NCAA tournament picture.

The Sun Devils also had Marshall, their second-leading scorer, back in the lineup after he missed the first game with a groin injury and Bachynski has been playing better after missing all three of his shots in Tucson.

Marshall made a huge difference in the rematch after an ugly start that featured more combined fouls (11) than points (nine) the opening eight minutes.

Marshall scored 12 of the Sun Devils' 19 points in the first half, hitting 5 of 10 shots while the rest of the team 3 for 17.

Arizona led 26-21 at halftime after dominating the glass, outrebounding Arizona State 26-15, including 9-3 on the offensive end.

Marshall continued to carry the Sun Devils early in the second half, scoring on a three-point play on a turnaround shot in the lane and earning a chance at another on a hard drive before missing the free throw.

Carson tried to take over after a quiet first half, scoring six straight points to put Arizona State up six, but Arizona fought back.

Neither team got good looks at the end of regulation and couldn't get a shot to fall in the first overtime.

Marshall returned to the fold for the Sun Devils in the second overtime and Bachynski all but ended a physical-but-entertaining game with another big block.

"It was one heck of a game," Miller said. "Someone has to win, someone has to lose. Unfortunately, we're the loser."