An unbroken 115-run stand between Kumar Sangakkara (77) and skipper Mahela Jayawardene (69) took the home side to 242-2 at the close after opener Upul Tharanga (72) put them on track for a big total here on Tuesday.
Sri Lanka, who gained a thin nine-run first innings lead, were 251 runs ahead with eight wickets in hand after left-hander Sangakkara and Jayawardene milked the bowling on a pitch that played easier than on Monday.
Sangakkara completed his 20th half-century and became only the seventh Sri Lankan to complete 4,000 Test runs during the knock, in which he has so far hit eight fours off 169 balls.
Jayawardene, who was lucky to be dropped by wicket-keeper Kamran Akmal off leg-spinner Danish Kaneria on 54, has so far hit ten fours and a six in his 28th Test fifty.
Sangakkara also added 74 for the second wicket with Tharanga, who was dismissed for 72 in Kaneria's first over after tea.
Tharanga struck 12 fours during his 133-ball knock and added 53 for the opening stand with veteran Sanath Jayasuriya (13).
Jayasuriya was dismissed by seamer Mohammad Asif, who had him caught down the leg-side by Akmal after he mis-hit a pull shot.
Sri Lanka earlier put up a spirited display to restrict Pakistan to 176, with their bowlers removing the last six batsmen for 52 to gain a narrow lead.
Pakistan, resuming on 124-4, were in trouble as paceman Farveez Maharoof returned his best bowling figures of 4-52.
Maharoof, who captured two wickets off successive balls on Monday, struck in his first over of the morning. He removed skipper Inzamam-ul Haq (31) off his third ball as the batsman nicked one to wicket-keeper Sangakkara.
The 21-year-old, playing his ninth Test, struck again a few overs later when he bowled Abdul Razzaq with an in-swinger to reduce Pakistan to 138-6.
He received splendid support from off-spinner Muttiah Muralitharan, who picked up three wickets Tuesday morning to ensure there was no rearguard action. Paceman Lasith Malinga also finished with three scalps.
The entire first day was washed out by rain.
The second and final Test will start in Kandy on April 3.