North Carolina extended its winning streak to three games while posting its fourth consecutive victory over the Cavaliers (2-8, 0-6).
Wide receiver Quinshad Davis caught a touchdown pass and threw for a score for the Tar Heels.
Kevin Parks rushed for 100 yards and a touchdown on 24 carries for Virginia. The Cavaliers suffered their seventh consecutive defeat, their longest losing streak within one season since 1981.
Williams completed 15 of 28 passes for 185 yards and two touchdowns.
It was North Carolina's first game since starting quarterback Bryn Renner had season-ending surgery on his left shoulder.
The Tar Heels had thrived in recent weeks using a two-quarterback system employing Renner and Williams, but Williams alone was enough against Virginia.
Wearing Renner's No. 2 to honor his injured teammate, Williams led the Tar Heels on long touchdown drives the first two times they had the ball.
Williams threw an 8-yard touchdown pass to Davis to cap the first series, and Davis returned the favor with a 29-yard strike to Williams on the final play of the first quarter.
Davis took a pitch from running back T.J. Logan on a reverse and lofted a pass to Williams, who was alone in the Virginia secondary, for the touchdown.
The Tar Heels kept the drives alive by going 5-for-5 on third down. Four of the conversions featured passes by Williams on third and 9 or longer.
North Carolina led 21-0 at halftime after Switzer turned trepidation into celebration in a matter of seconds. He muffed a 49-yard punt by Virginia's Alec Vozenilek, but the ball bounced right back into his hands at the 15.
Switzer took off up the middle, broke a tackle and worked his way to the left sideline. He eluded Vozenilek at the Virginia 40 and coasted into the end zone for an 85-yard touchdown.
Trailing 28-0 after a 3-yard touchdown run by Williams, the Cavaliers showed signs of life when Parks had an 8-yard touchdown run late in the third quarter.
Anthony Harris intercepted a pass by Williams on the ensuing possession, setting up Virginia at the North Carolina 41.
But two plays later, Green intercepted an ill-advised pass by the scrambling Watford and returned it 62 yards for a touchdown to put the Tar Heels ahead 35-7.