The duo came together with their side on 19 for three and in grave danger of failing to make the 223 runs needed to make Sri Lanka bat again for the match.
But by the close Younis' 62 and Misbah's 53 had steered Pakistan to the relative comfort of 132 for three and 91 runs behind.
Their situation was such because of a devastating spell of new-ball bowling from Sri Lanka.
Pakistan got themselves into all sorts of trouble as Ahmed Shehzad (nine), Mohammad Hafeez (one) and Khurram Manzoor (six) all edged behind, with Rangana Herath taking one and Nuwan Pradeep two.
But Younis (41) and Misbah (27) got through to lunch with no further damage as part of an overall 85 for three, still some 138 behind.
That break allowed them to take stock and they played diligently overall in the evening session, although Misbah only narrowly avoided a run-out on 41.
Earlier Mahela Jayawardene passed Steve Waugh as Test cricket's eighth all-time leading run scorer.
The 36-year-old moved from his overnight 106 to 129 as his side were bowled out for 388.
A collapse from 318 for four to that total was not a great achievement, but at least Jayawardene gave Sri Lankan fans something to cheer about.
He is now clear of the Australian great on 10,940 runs, but that tally could not protect him from being bowled by Saeed Ajmal in the morning session.
Also departing was Angelo Mathews, with the captain unable to add to his overnight 42 before he was snared by Rahat Ali.
Ali also threw down the stumps to run out Herath (six), with Prasanna Jayawardene cleaned up by Junaid Khan (nine). The innings quickly folded after that, with Shaminda Eranga going to Bilawal Bhatti and Nuwan Pradeep falling to Ajmal.