Azhar Ali stroked a century and Asad Shafiq an unbeaten half-century as Pakistan closed day four of the third and final Test against Sri Lanka in Pallekele 190 runs ahead.
Azhar's 136 in 283 balls gave them the platform to close on 299 for eight, Sri Lanka having been bowled out on day three for 335 in reply to 226.
Sri Lanka lead the series 1-0 and with Pakistan's last two recognised batsmen - Shafiq and Adnan Akmal - at the crease, it sets up an intriguing final day.
Shafiq was not out on 55 having faced 134 deliveries while Mohammad Hafeez made 52 opening the innings to help Pakistan recover from losing Taufeeq Umar for four late last night.
He and Azhar added 94 for the second wicket before Hafeez fell to Dilhara Fernando and Rangana Herath dismissed Younus Khan for 19 and Misbah-ul-Haq for five.
Azhar and Shafiq put on exactly 100 for the fifth wicket but Azhar's dismissal, caught behind off Fernando, precipitated the wickets of Mohammad Sami (3), Umar Gul (0) and Saeed Ajmal (5) as Sri Lanka revived their own hopes of victory.
As Shafiq and Akmal frustrated the home side, Fernando finished the day with figures of three for 65 and Herath four for 64.
© Cricket World 2012
Open an account with bet365 today and qualify for up to £200 in free bets with our fantastic 100% Deposit Bonus.