Pallekele - Skipper Angelo Mathews battled his way to an unbeaten 77 as Sri Lanka seized the advantage in the series-deciding third and final Test against Pakistan in Pallekele on Sunday.
The hosts gained a first innings lead of 63 runs and then recovered from 35-3 in their second knock to post 228-5 by stumps on a rain-interrupted, but absorbing, third day's play.
Mathews led from the front against a tiring Pakistani attack, adding 45 for the fourth wicket with Upul Tharanga (48) and 81 for the fifth with Jehan Mubarak (35).
Mubarak marked his recall to the Test side after almost eight years with a gutsy 35 before he was caught at short-leg off Yasir Shah in the final session.
Dinesh Chandimal returned to form with 39 not out, helping his captain put on 67 for the sixth wicket before bad light ended the day's play early.
Sri Lanka will begin the fourth day with a commanding overall lead of 291 runs with five wickets in hand, having a clear advantage on the wearing pitch to break the 1-1 deadlock in the series.
Left-arm seamer Rahat Ali grabbed two quick wickets and new ball partner Ehsan Adil took one to leave Sri Lanka tottering in the morning session.
Rahat bowled first innings century-maker Dimuth Karunaratne for 10 and yorked Lahiru Thirimanne for no score in an inspired eight-over opening spell.
In between, Ehsan had Kaushal Silva caught in the slips by a diving Misbah-ul Haq for three.
Tharanga and Mathews repaired the early damage on either side of lunch before Yasir broke the partnership.
Having had a leg-before review turned down by the TV umpire off the previous ball, the leg-spinner forced Tharanga to edge the next delivery to Azhar Ali at short-leg.
Play was held up twice by passing showers in the morning session and once again before tea, keeping the hard-working ground staff on their toes as they rushed in the covers to guard both the wicket and the outfield.
Earlier, the tourists added six runs to their overnight score of 209/9 before they were all out for 215 in the day's second over in reply to Sri Lanka's first innings total of 278.
Pakistan's six runs in the morning all came off the bat of Sarfraz Ahmed, who remained unbeaten on 78.
Last man Imran Khan, who had not faced a ball in four previous Tests, survived for seven deliveries before he was bowled by off-spinner Tharindu Kaushal for zero.
Kaushal, Dhammika Prasad and Nuwan Pradeep finished with three wickets each.
Pakistan won the first Test in Galle by 10 wickets and Sri Lanka took the second in Colombo by seven wickets.