Off-spinner Saeed Ajmal removed Jayawardene for 46 near stumps on the fourth day after an exciting tussle between the bat and ball as Sri Lanka finished at 133-5.
They now lead by 220 runs with five wickets in hand and a full day's play to retain their 1-0 lead.
They won the second Test in Dubai by nine wickets after the first ended in a draw in Abu Dhabi.
At the close Angelo Mathews was unbeaten on 14 and with him Prasanna Jayawardene was on six not out.
Ajmal could have had Prasanna caught behind off his gloves on nought but wicketkeeper Sarfraz Ahmed failed to hold the catch, much to Pakistan's desperation.
Jayawardene, who struck 129 in Sri Lanka's nine wicket win in the second Test in Dubai, swept Ajmal over deep square-leg for a six to complete 11,000 runs in his 141st Test.
He became the eighth batsman in all Test cricket and the first Sri Lankan to score 11,000 or more runs in a list topped by now-retired India's Sachin Tendulkar with 15,921.
Jayawardene hit four boundaries and a six during his defiant knock.
