Resuming at a precarious 35-2 after losing both the openers on Friday, Ali (48) and Younis (51) have so far added 91 during their third wicket stand to take Pakistan to 126-2 in reply to Sri Lanka’s first innings total of 413.
Sri Lanka, who swiftly dismissed both Pakistani openers Mohammad Hafeez (six) and Taufiq Umar (19), were a bowler short after frontline paceman Dhammika Prasad injured a muscle and was unable to bowl on the third morning.
That helped Ali, who scored his maiden hundred in the last match in Dubai, and Younis to bat out the first session without any trouble.
Younis swept off-spinner Suraj Randiv for his eighth boundary to complete his 26th half-century in his 71st Test. Ali has so far hit six boundaries.
Resuming at 35-2, the Pakistani batsmen were cautious before Younis posted the 50 with a crisp boundary off left-arm paceman Chanaka Welegedara to raise the tempo, which also prompted Ali to play his shots freely.
Younis, on 30, survived a close leg-before shout against left-arm spinner Rangana Herath who extracted some spin out of an otherwise batting-friendly pitch.
Pakistan lead the three-Test series 1-0 after their crushing nine-wicket win in the second match in Dubai. The first Test in Abu Dhabi ended in draw.