Sri Lanka were 47 for one at the close, still trailing Pakistan by 267 runs, with former captain Kumar Sangakkara [ Images ] (27) and opener Lahiru Thirimanne (20) at the crease.
Umar Gul rounded off a superb day for Pakistan by dismissing Tharanga Paranavitana [ Images ] lbw with the first delivery of the innings.
Resuming on his overnight score of 109, the 30-year old Umar, whose previous highest in Test matches was 135, added 160 for the second wicket with Azhar Ali and continued his patient approach to accumulating runs.
He got past the 200-run mark with a pulled four to the mid-wicket boundary off paceman Suranga Lakmal.
The left-handed opener hit 17 boundaries and a six during his 496-ball stay at the crease before he was run out on 236.
He added 82 for the third wicket with Younis Khan [ Images ] (33), 76 with captain Misbah-ul Haq (46) for the fourth and another 75 with Asad Shafiq (26) for the fifth wicket.
Pakistan declared soon after on 511 for six, asking Sri Lanka to bat for the remaining 11 overs in the day.
Left-arm seamer Chanaka Welegedara [ Images ] bowled a testing spell in the morning and beat Ali for pace to rattle his off-stump in the seventh over of the day, which turned out to be Sri Lanka's only success in the morning session.
Welegedara also trapped Younis lbw with a ball that straightened a bit after pitching.
Misbah fell to the left-arm spin of Rangana Herath [ Images ], who finished with three for 126, and was caught behind trying to increase Pakistan's scoring rate.
Pakistan play home Tests in the Gulf region because of security fears in their own country. The game is the first in a three-match series.
Sri Lanka (1st innings): 197
Pakistan (1st innings): (overnight 259-1)
Mohammad Hafeez [ Images ] lbw b Herath 75
Taufiq Umar run out 236
Azhar Ali b Welegedara 70
Younis Khan lbw b Welegedara 33
Misbah-ul Haq c P Jayawardene b Herath 46
Asad Shafiq not out 26
Umar Gul c Mathews b Herath 0
Extras: (B-3, LB-3, NB-16, W-3) 25
Total: (for six wkts in 174.4 overs) 511
Fall of wickets: 1-118, 2-278, 3-360, 4-436, 5-511, 6-511.
Bowling: Welegedara 30-5-80-2, Lakmal 24-3-108-0, Herath 61.4-16-126-3, Pradeep 27-1-107-0, Dilshan 32-6-84-0.
Sri Lanka (2nd innings):
T Paranavitana lbw b Gul 0
L Thirimanne not out 20
K Sangakkara not out 27
Total: (for one wkt in 11 overs) 47
Fall of wicket: 1-0.
Bowling: Gul 4-0-16-1, Cheema 5-0-18-0, Ajmal 1-0-4-0, Khan 1-0-9-0.