Pakistan trail Sri Lanka, who lead the two-test series 1-0, by 76 runs after the hosts were bowled out for 320 in their first innings.
Herath took the wickets of experienced pair Younus Khan and captain Misbah-ul-Haq in seven balls after tea to reduce Pakistan to 140-5, but Asad Shafiq (42) and Sarfraz (66 not out) added 93 for the sixth wicket before Herath separated them towards the end of the day.
He bowled Shafiq between bat and pad with an arm ball as the batsman prodded forward to finish the day with figures of five for 98.
Herath is the leading wicket-taker in test cricket for the calendar year with 47 wickets.
Sarfraz reached his third consecutive half-century of the series after successfully reviewing a lbw dismissal off Dilruwan Perera when he had made 24.
Earlier, Pakistan left-arm paceman Junaid Khan completed his fifth five-wicket haul against Sri Lanka but not before the hosts’ tailenders frustrated them to add 59 valuable runs in the morning.
Pakistan’s hopes of finishing off the Sri Lankan innings quickly were stalled by Dhammika Prasad (13), Herath (17) and Chanaka Welegedara (27 not out). – Reuters