The victory also kept Duke in the thick of the ACC Coastal Division race. The Blue Devils and No. 11 Georgia Tech each have one loss in league play, and their meeting on Nov. 14 in Durham, N.C., could be decisive.
Virginia (3-5, 2-2) lost its second in a row as its pass defense, ranked fifth in the nation coming in, was unable to slow the Lewis-led sixth-best passing attack in the country.
Lewis was 24 for 40 for 343 yards, despite being sacked six times.
Before he and Varner hooked up for the big play down the middle of the field, the Cavaliers looked like they might pull of a somewhat dramatic victory of their own.
Trailing 12-10, Virginia drove to the Blue Devils 40, where Sewell rolled left and hit Joe Torchia for a 19-yard completion on fourth-and-1. On the next play, they teamed up again, Sewell rifling a pass to Torchia down the middle of the field to put Virginia up 17-12.
The Cavaliers' chances improved when Chase Minnifield made a diving interception in the end zone to stop another Duke drive, but Virginia went conservative on offense and had to quickly punt. The Blue Devils took over at their 33, and five plays later, Lewis found Varner in one-on-one coverage in the middle of the field and he pulled in the go-ahead pass.
Until then, Virginia had allowed Lewis to move up and down the field with a possession passing game, but forced Duke to settle for field goals of 44, 28, 34 and 25 yards.
The Cavaliers came into the game having scored a total of two offensive touchdowns in three ACC games, and managed just 81 yards of offense and trailed 9-3 at the end of the half.
But Sewell led a 66-yard drive to his 1-yard dive with the first possession of the third quarter, giving the Cavaliers their first lead, and then gave them the lead again later.
The Blue Devils added a late touchdown and field goal after the go-ahead touchdown.