CHAPEL HILL, N.C. (AP) Virginia limped in with losses in three of its last four games. Thanks to a huge night from their quarterback and a couple of timely stops, the Cavaliers are now in control of their division.

Bryce Perkins amassed 490 total yards and accounted for five touchdowns to help Virginia beat North Carolina 38-31 on Saturday night.

Perkins threw three touchdown passes and ran for 112 yards and two scores as the Cavaliers (6-3, 4-2 Atlantic Coast Conference) took over sole possession of first place in the ACC's Coastal Division. They also became bowl-eligible for the third consecutive season.

''We're not done yet,'' Perkins said. ''We've got to keep going to complete our goals.''

Perkins gave Virginia the lead for good on the second play of the second half, scrambling through North Carolina's defense for a career-long 65-yard touchdown.

The play was part of an avalanche of points for the Cavaliers, who trailed 17-10 late in the second quarter before scoring touchdowns on four consecutive possessions.

The Tar Heels twice had a chance to tie the game late in the fourth quarter. Their best opportunity came from Virginia's 6-yard line with five minutes remaining, when Sam Howell's fourth-down pass to Beau Corrales was incomplete.

''We knew we had to get a stop,'' Virginia defensive end Eli Hanback said. ''There was no other option.''

Howell was 15 of 29 for 353 yards and four touchdowns for North Carolina (4-5, 3-3).

Dyami Brown had six catches for a career-high 202 yards and three touchdowns for the Tar Heels.

''Physically, psychologically and emotionally, these guys have played their guts out every week,'' North Carolina coach Mack Brown said. ''Every game has come down to the end. It's been unbelievable.''

THE TAKEAWAY

Virginia: The Cavaliers were the preseason pick to win the wide-open Coastal Division, and they have a good chance to fulfill that prophecy. Virginia's schedule down the stretch is favorable with all three of its games at home. The Cavaliers have an open date in between games they should win against Georgia Tech and Liberty. The finale against rival Virginia Tech on Nov. 29 could be huge.

North Carolina: It was another day at the office for the Tar Heels, who have played perhaps college football's most drama-filled season. The problem is that they fell short again. Eight of North Carolina's nine games have been decided by seven points or fewer, and the Tar Heels are 3-5 in those games.

BRYCE IS NICE

Perkins completed 30 of 39 passes for 378 yards and no interceptions, but he left a lasting impression with his game-breaking touchdown run. He escaped a sack by Jason Strowbridge, scrambled to his left, eluded two other defenders, and tight-roped down the sideline before running away from safety Myles Dorn.

''It's almost like watching a cheetah run,'' Virginia offensive tackle Ryan Nelson said. ''He's the fastest thing out there. You're not going to catch him.''

THE LITTLE THINGS

Here's how the Cavaliers won on the road: They had no turnovers, scored on all five trips inside the 20, converted their lone fourth down and had just one penalty for 5 yards. ''It didn't seem that the circumstance was too big, and it didn't seem like the pressure was there,'' Virginia coach Bronco Mendenhall said.

INJURY UPDATE

Mendenhall said starting safety Brenton Nelson, who did not play, is out for the season because of injury. Mendenhall said the team found out Nelson's status on Thursday.

DYNAMITE DYAMI

Dyami Brown played a large role in UNC's first 17 points. He had a 57-yard catch and run to set up a field goal for the game's first score, and then he caught touchdown passes of 47 and 34 yards. Brown flashed his elite speed on all three plays, outrunning cornerback De'Vante Cross on the two first-half touchdowns.

MR. CONSISTENCY

With his four scoring strikes, Howell has thrown multiple touchdown passes in all nine games of his college career. The freshman has 26 touchdown throws and five interceptions for the season.

UP NEXT

Virginia: The Cavaliers host Georgia Tech on Saturday to begin a three-game homestand to close the regular season.

North Carolina: The Tar Heels play at Pittsburgh, whom they've beaten six consecutive times, in a Thursday night game on Nov. 14.

---

More AP college football: https://apnews.com/Collegefootball and https://twitter.com/AP-Top25

Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.