The Terrapins (7-3, 4-2 ACC) remained in control of their chance to play in their first ACC championship game. Maryland will gain the Atlantic Division's berth if they win their final regular season games, both at home, against Florida State and North Carolina State.
Virginia (4-6, 1-5) saw its three-game winning streak in the series end on Senior Day, and lost to its northern border rival for only the fifth time in the last 19 meetings.
But they made it interesting into the fourth quarter before fizzling.
Adams scored his third touchdown on a 2-yard run just 35 seconds into the quarter, capping a drive kept alive by a pass that went through the hands of Virginia linebacker Darnell Carter and into the arms of LaQuan Williams for a 26-yard gain on third-and-14.
After Virginia backed up inside its own 5 yard-line and punted, with the Terps taking over at the Cavaliers' 42, O'Brien drove them for the clinching score in eight plays. His 2-yard toss to Da'Rel Scott pushed the lead to 35-23, and the outcome was determined.
The Terps freshman finished 17 for 28 for 289 yards, and Smith caught seven for 157 yards. Verica was mistake-free before the final quarter, and was 25 for 43 for 265 yards.
The Terps led 21-20 at halftime, and all three scoring drives included a long pass.
O'Brien hit Smith for 35 yards on a third-and-6 on the first drive, ending with Adams' 6-yard run. O'Brien hit Smith again, this time for 62 yards, on third-and-4 on the next scoring drive before running it in from the 12 for the points. And he underthrew but hit Quintin McCree for 55 yards on the final drive before Adams ran it in on fourth-and-goal from the 1.
The Terps also converted a fourth-and-1 from the 12 on the latter drive, and scored with 4:01 left. It gave Maryland a 21-10 lead and the chance to take command with one more score.
Instead, the Cavaliers scored 10 points in the 4 minutes before the intermission.
After the Terps went three-and-out, Verica drove the Cavaliers from their 28 to the Maryland 25. When a flag pushed them back to the 35 with 3 seconds left in the half, Chris Hinkebein booted his first career field goal, from 52 yards, making it 21-20 at the break.
Earlier, Virginia scored on a fake field goal, holder Jacob Hughes flipping the ball to Terence Fells-Danzer, who went off the right side for a 16-yard touchdown pass.
Robert Randolph also kicked field goals of 35 and 37 yards for the Cavaliers.