The seemingly easy target, however, soon loomed large as Sami Aslam (2), Azhar Ali (0) and Shan Masood (7) were sent quickly back to the pavilion.
Earlier in the opening session today, pacer Mohammad Abbas bagged two wickets to take Pakistan within sight of victory on the final day of the Test.
Abbas dismissed Mendis and Lakmal within the opening hour of the morning session, getting the former trapped LBW for 18 and the latter caught in the deep for 13.
Shah starred with figures of 51-5. On Sunday, he grabbed the key wicket of Dinesh Chandimal to leave Sri Lanka fighting to avoid defeat.
It was tough to negotiate spin on a fourth-day Sheikh Zayed Stadium pitch, but despite a 32nd Test five-wicket haul for veteran Sri Lankan spinner Rangana Herath, Pakistan posted 422 to take a slender three-run lead.
Sri Lanka had made 419 in their first innings.
Herath´s 5-93 in 40 overs were well foiled by a brilliant 76 by Test debutant Haris Sohail, as initially, it looked as though Sri Lanka would take a first-innings lead.
Pakistan then hit back in the second innings through Shah, who first had opener Dimuth Karunaratne caught for 10 and then dismissed first-innings centurion Chandimal, caught at slip, for seven.
Sohail followed his responsible knock by claiming Kaushal Silva´s wicket, whom he trapped leg before for 25, while part-timer Asad Shafiq had Lahiru Thirimanne for seven.