The South African skipper made 227 not out for his fifth double ton while De Villiers -- dropped off the first delivery by wicket-keeper Adnan Akmal off paceman Mohammad Irfan -- was unbeaten on 157 for his 17th Test century.
The duo plundered a hapless Pakistan attack to take South Africa to 460-4 at close on the second day, giving them a big 361-run lead with three full days to play to force a series-levelling win. Pakistan won the first Test by seven wickets in Abu Dhabi last week.
Smith and De Villiers have set an all time South African record for the fifth wicket in Tests with 326, beating the previous best of 267 set by Jacques Kallis and Ashwell Prince against the West Indies at Antigua in 2005. The experienced duo plundered Pakistan's spin-cum pace attack on Dubai stadium pitch which gave little help to the bowlers who only managed to dismiss nightwatchman Dale Steyn (seven) in the first hour.
Smith reached his fifth double hundred with a couple off spinner Zulfiqar Babar towards mid-wicket, also completing 9,000 runs in 112 Tests. He is the 12th batsmen in all Test cricket to reach 9,000 and second behind team-mate Jacques Kallis who so far has 13,140 runs in 164 Tests.
The South African captain, seeking to keep his team's unbeaten run away from home since losing to Sri Lanka in 2006, raised his arms to the applause of his team-mates. In all Smith has hit 16 boundaries off 367 deliveries of complete domination.
De Villiers was in more punishing mood, having hit 16 boundaries and a six off 262 balls. Pakistan keeper faltered once more when he dropped Smith off spinner Zulfiqar Babar when the batsman was on 202, capping a miserable day for his team.
Smith hit spinner Saeed Ajmal for three consecutive boundaries to reach his 9th score of 150 plus. Smith, overnight 67, anchored the innings and reached his century with a straight drive off Ajmal for his only sixth boundary. It took Smith 204 balls to reach the milestone.
Pakistan took the new ball straightaway after the 80th over but it only upped the scoring rate with de Villiers hitting Irfan for two successive boundaries and one off Babar to bring up his fifty. He also completed 1,000 runs against Pakistan in 12 Tests.
Resuming at 128-3, South Africa lost Steyn in the seventh over of the day, bowled for seven as he offered no stroke to a Irfan delivery. Irfan, who bowled at good pace, could have had De Villiers off the very next ball but Akmal failed to hold on to a edge towards his right.
Pakistani spinners led by Saeed Ajmal (2-132) bowled tirelessly but failed to exploit any turn on a pitch that was expected to give slow bowlers help. Irfan had figures of 84-1 in 27 overs, while Babar had figures of 1-112.