Openers Khurram Manzoor and Ahmed Shezad were unbeaten on eight and 12 respectively. They have 62 overs left to achieve their target or bat out for a draw.
Pakistan have never chased more than 314 - against Australia in Karachi in 1994 - to win a Test match.
Earlier, Sri Lanka declared their second innings at 480-5 after batting an hour and 30 minutes.
Skipper Angelo Mathews, who batted brilliantly for his second Test hundred and a career best score on Friday to pull Sri Lanka out of trouble, remained not out on 157 while Prasanna Jayawardene was 63 not out.
The two shared an unbroken 156-run stand for the sixth wicket to put Sri Lanka in a position from where they harboured hopes of an unlikely win.
Mathews batted for 457 minutes, hit 16 boundaries and a six in an extraordinary display of patience and fight.
Prasanna ably supported his skipper during his 169-ball knock, hitting six boundaries and a six.
Pacemen Junaid Khan finished with 3-93, while Bilawal Bhatti took 2-146.
Off-spinner Saeed Ajmal, who took 18 wickets in Pakistan's 1-0 win over Sri Lanka here in 2011, finished wicket-less in his 49 overs, conceding 115 runs - only the fifth time that he failed to get a wicket in an innings in his 31 Tests.
The second Test starts in Dubai from January 8.
COMMENTS (2)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ
misleading title, we haven't won the game... pakistan need to chase ET
Target of 302 to win in 67 overs, I think Pak should go for it