Herath, who took 11 wickets in Sri Lanka's 21-run win in the first Test in Abu Dhabi, removed a well set Azhar Ali for 59 after he dismissed Babar Azam for eight.
Haris Sohail was 38 not out with Sarfraz Ahmed on five as Pakistan still trail Sri Lanka's first innings total of 482 by 296 runs.
They need another 97 to avoid the follow-on.
Azhar had added an invaluable 71 for the fifth wicket with Sohail but Herath trapped him leg-before and reviewed it to overturn a not-out decision.
Pacer Lahiru Gamage took his first wicket in Test cricket when he bowled Shan Masood through the gate after the opener had made 16.
Sami Aslam was trapped leg before by off-spinner Dilruwan Perera for 39 to leave Pakistan two down for 65.
Asad Shafiq fell for 12. Sri Lanka lead the two-match series 1-0.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)