The lower order increased Pakistan's lead to 200 runs against South Africa on the third day of the second and final test on Saturday.
Allrounder Faheem Ashraf and Mohammad Rizwan were dropped off successive deliveries before featuring in a 52-run sixth-wicket stand which guided the home team to 129-6 in the second innings at stumps.
Rizwan was unbeaten on 28 but Ashraf fell late in the second session for 29 when he sliced a catch at point to give George Linde (3-12) his third wicket.
“We dropped a couple of catches, but I am sure the boys will be hungry tomorrow to win the match and level the series," Linde said.
“Anything under 300 (runs), we will take it ... and I am sure batters will take us over the line in the next innings."
Earlier, fast bowler Hasan Ali’s (5-54) five-wicket haul earned Pakistan a vital 71-run first innings lead as the visitors were bowled out for 201, half an hour after lunch.
Hasan, returning to the five-day format after a two-year absence due to injuries in Pakistan's seven-wicket win in the first test, picked up three wickets on Saturday, but poor running cost South Africa with two batsmen getting run-outs.
“I am really excited because it was really frustrating to stay out of test matches for so long with multiple injuries," Hasan said. “The old ball was reverse swinging and I bowled at the right areas."
Temba Bavuma, who resumed on 15, fought a lone battle to remain unbeaten on 44 off 138 balls before Hasan wrapped up the innings by claiming the last two wickets of successive deliveries.
The diminutive Bavuma successfully overturned a leg before decision against him in the fourth over of the day, but could not get enough support from the lower order.
Bavuma and Wiaan Mulder (33) dug in for 90 minutes and raised a half century stand before Pakistan struck with two quick wickets.
Mulder was shaping up well against the spinners as he lofted Yasir Shah for a six over long off and also swept well against left-arm spinner Nauman Ali before he was run-out while going for a needless second run.
George Linde scored a run-a-ball 21 with three fours and a six before he was deceived by Hasan with a slower delivery and was clean bowled.
Resuming on 106-4, captain Quinton de Kock’s poor run of form in the series continued when he could add only five to his overnight score of 24 and was clean bowled by Shaheen Afridi (1-37) in the third over of the day.
De Kock, who hit five boundaries late on the first day, attempted an over-ambitious drive against Afridi too soon and dragged the ball back onto his stumps.
Pakistan should have got Maharaj without scoring before lunch but Yasir Shah dropped him in the second slip before Nauman missed a sitter shortly after the break. Umpire Ahsan Raza erred for the second time in the day when Maharaj successfully went for lbw television review after the on-field umpire had ruled him out off Hasan as South Africa moved to 188-7 at lunch.
Hasan returned after lunch and cleaned bowled both Maharaj and No. 11 Andrich Nortje and Rabada was run out.
Pakistan’s problems up front continued in the series after it lost openers Abid Ali for 13 and Imran Butt for zero before going to tea at 42-2 to lead by 113 runs.
Kagiso Rabada trapped Butt lbw before Pakistan had scored in the second innings. The right-handed opener, who made his test debut at Karachi where Pakistan won by seven wickets, could score only 36 runs in four innings after Shan Masood was dropped for the home series.
Abid also had below-par scores of 4, 10 and 6 in the previous three test innings before he was caught behind off left-arm spinner Keshav Maharaj for his top score in the series.
Babar Azam (13) fell leg before wicket for the third time in the series against Maharaj as the Pakistan skipper failed to read the arm ball of the left-arm spinner which didn’t turn.
Linde then reduced Pakistan to 76-5 when he had Azhar Ali lbw and Fawad Alam offered a regulation bat and pad catch.
Pakistan could have been 76-7, but first Ashraf was dropped by Elgar off Linde in the slip and then Rassie van der Dussen couldn’t hold onto a sharp chance off Rizwan’s bat at silly point.
Both batsmen counterattacked thereafter with Ashraf smashing Maharaj for three boundaries in an over before the left-hander threw away his wicket.
“Two hundred runs will not be easy to chase, but we will try to get 40-50 more so that we don't put our bowlers under too much pressure," Hasan said.