Pakistan is heading for a series-clinching victory in the second test against Sri Lanka despite a fighting century on Sunday by Oshada Fernando.
Fernando was 102 not out at stumps on Day 4 but his gritty innings was only likely to delay Pakistan's win.
Sri Lanka was 212-7 chasing a daunting victory target of 476. Pakistan needs just three more wickets on the final day in Karachi to take the two-match series 1-0 and make a winning return to test action on home soil. The first test was drawn.
This is the first test series in Pakistan for a decade. A 2009 series against Sri Lanka was abandoned after a deadly terrorist gun attack targeted the Sri Lankan team when it was traveling by bus to a game in Lahore. No Sri Lankan players or officials died but policemen and civilians did.
Since then, Pakistan wasn't allowed to play games at home because of security concerns. But its comeback series looks like it'll be a success.
The 16-year-old fast bowler Naseem Shah took 3-31 as Pakistan closed in on its win. Fernando resisted right through to stumps but the one other batsmen to have some success didn't quite make it. Wicketkeeper Niroshan Dickwella was out for 65 three overs from the end of the day.
Earlier, Pakistan's top four batsmen all made centuries in its second innings to put the home team in a dominant position.
Azhar Ali (118) and Babar Azam (100 not out) completed their centuries on Sunday to go with hundreds by openers Abid Ali (174) and Shan Masood (135) on Day 3. Pakistan declared on 555-3.
The feat by Pakistan's top order was only the second time the top four had all made centuries in the same innings in a test. India's Dinesh Karthik, Wasim Jaffer, Rahul Dravid and Sachin Tendulkar did it in 2007 against Bangladesh.
Resuming the day at 395-2, Pakistan put on 160 in 27 overs with Azhar and Babar in complete charge.
Azhar's century was the 16th of his career and sixth against Sri Lanka. The captain last scored a hundred over a year ago, a span of 14 innings. His 118 came off 157 balls with 13 boundaries before he was stumped off Lasith Embuldeniya.
Babar, 100 off 131 balls, along with Mohammad Rizwan (21 ) were unbeaten when Pakistan declared.
Pakistan's bowlers kept up the momentum.
They took the first two Sri Lankan wickets in five balls to see the tourists slip to 40-2. Sri Lanka captain Dimuth Karunaratne (16 off 28 balls) edged behind off Mohammad Abbas. Kusal Mendis was out for a duck with a thick edge flying to Babar at third slip off teenager Shah.
The experienced Angelo Mathews fell for 19 to a low catch by wicketkeeper Mohammad Rizwan that was confirmed by the third umpire.
A 104-run stand between Fernando and Dickwella was broken by spinner Haris Sohail. And Shah got his third wicket right at the end of the day when Dilruwan Perera edged behind for 5.
The first test ended in a draw after more than nine sessions were disrupted by bad weather in Rawalpindi.