De Villiers scored 278 not out to pass Graeme Smith's landmark of 277 against England in Birmingham in 2003, with captain Smith declaring their first innings closed on 584 for nine shortly afterwards.
Taufeeq Umar (16) and Azhar Ali (34) then took Pakistan to 59 for one before bad light stopped play and stumps were drawn with seven overs remaining in the day.
De Villiers came to the wicket with the score a parlous 33 for three on the first morning but immediately looked settled and occupied the crease for more than 11 hours, taking 418 deliveries and hitting 23 fours and six sixes.
South Africa had begun the second day on 311 for five.
SCORE BOARD
South Africa (I Innings, O/n: 311/5):
Smith c Adnan b Tanvir 10
Petersen c Misbah b Tanvir 2
Amla c Adnan b Tanvir 4
Kallis b Tanvir 105
De Villiers (not out) 278
Prince c Shafiq b Hafeez 32
Boucher b Tanvir 45
Botha b Rehman 12
Steyn c Hafeez b Rehman 27
Harris c Adnan b Tanvir 19
M Morkel (not out) 35
Extras (B-6, lb-1, W-2, nb-6) 15
Total (9 wkts decl, 153 overs) 584
Fall of wickets: 1-2, 2-6, 3-33, 4-212, 5-268, 6-341, 7-383, 8-442, 9-477.
Bowling: Gul 36-6-137-0, Tanvir 28-6-120-6, Sami 24-1-101-0, Younis 3-1-11-0, Rehman 50-9-150-2, Hafeez 12-0-58-1.
Pakistan (I Innings)
Hafeez lbw Steyn 2
Taufeeq (batting) 16
Azhar (batting) 34
Extras (B-5, W-1, nb-1) 7
Total (for 1 wkt, 18 overs) 59
Fall of wicket: 1-2.
Bowling: Steyn 7-0-27-1, M Morkel 7-3-15-0, Kallis 4-1-12-0.
Deccan Herald is on WhatsApp Channels| Join now for Breaking News & Editor's Picks