Pakistan finished the second day of the second cricket Test at 281-4 in reply to Sri Lanka's first innings total of 239, gaining an overall lead of 42 runs at Dubai Stadium.