Sri Lankan opener Dimuth Karunaratne hit a career best 196 which left Pakistan fighting to avoid defeat in the second day-night Test in Dubai on Saturday.
Captain Dinesh Chandimal made an unbeaten 155 as Sri Lanka put the pressure on Pakistan on the second day of the first Test in Abu Dhabi on Friday.
Set a challenging target of 377 runs, the tourists recovered from a shaky 13-2 to move to 230 without further loss by stumps on the rain-free fourth day in Pallekele. Shan Masood (114) and Younis Khan (101) compiled unbeaten centuries.
Khurram Manzoor's unblemished 131 not out with 14 fours guided Pakistan to 263-3 at stumps after South Africa was dismissed for 249 in its first innings.
The 31-year-old Farhat has failed to cement his place in the Pakistan team in a turbulent 13-year career and has often been criticised for lack of consistency.