Ajmal took 2-62 to leave Sri Lanka struggling at 166-5 before Angelo Mathews (24) and Prasanna Jayawardene (28) saw off the day with a 54-run unfinished stand on a spin-friendly Sharjah stadium pitch. (Agencies)
Pakistan had to rue a dropped catch by paceman Mohammad Talha when Mathews had not scored while a leg-before decision against Prasanna was turned down on referral -- two lapses which denied Pakistan the chance to take full control.
Pakistan took the second new ball after 87 overs with Sri Lanka on 206-5 but Mathews, who hit a career best 157 not out and alongwith Prasanna helped Sri Lanka to salvage a draw in the first Test in Abu Dhabi, batted sensibly.
Sri Lanka leads the three-match series 1-0 after winning the second match in Dubai by nine wickets. The first Test ended in a draw.
Pakistan grabbed the key wickets of Kumar Sangakkara (52) and Mahela Jayawardene (47) on either side of tea.
Sangakkara flicked a straight drive into the hands of mid-wicket from paceman Junaid Khan, two balls after completing his half-century.
The left-hander could have been dismissed on 14 when he gloved a miscued sweep which Younis Khan caught in the slip off Rehman but Indian umpire Sundaran Ravi turned down a vociferous appeal.
Unfortunately Pakistan did not challenge the decision while television replays showed the ball had hit the batsman's glove.
Sangakkara took full advantage of the lucky escape, hitting Junaid for his fifth boundary to reach his 44th half-century but perished soon after.
Jayawardene, who hit 129 in Sri Lanka's nine wicket win in the second Test in Dubai, hit two sixes and five boundaries during a 108-ball knock but edged a turning ball and was smartly caught at short-leg.
Ajmal took 2-62 to leave Sri Lanka struggling at 166-5 before Angelo Mathews (24) and Prasanna Jayawardene (28) saw off the day with a 54-run unfinished stand on a spin-friendly Sharjah stadium pitch.