India, leading 2-1 in the series, struggled to make runs and lost crucial wickets early in the day, including skipper Virat Kohli who failed to score. But Pant put on 113 for the seventh wicket with Sundar to hit back after the England bowlers reduced India to 146 for six at one stage.
Washington Sundar and Shardul Thakur, in just his second Test, put on 123 runs for the seventh wicket — a record for India at the Gabba — taking their team from a precarious 186 for seven to 309 before Thakur was bowled by Pat Cummins for an entertaining 67.
South Africa were in trouble at 106-4 after the second day's play on a tricky Rawalpindi stadium pitch, trailing Pakistan's first innings total of 272 by 166 runs. Earlier, Nortje grabbed his third five-wicket haul with 5-56 to restrict Pakistan's total.
The Pakistan captain hit a stroke-filled 103 off 104 balls and shared a second-wicket partnership of 177 with Imam-ul-Haq, who made 70. But Babar's dismissal started a collapse in which fast bowler Anrich Nortje took four wickets in four overs.
India started day three of the day-night Test on nine for one and with a 62-run lead, looking to build a competitive second innings total for Australia to chase.
Faheem Ashraf was dismissed for 91, his highest Test score, just before the close of the third day’s play at Bay Oval as Pakistan were bowled out for 239, still 192 runs behind New Zealand’s 431.