Babar Azam fell one short of a maiden Test century after a farcical Azhar Ali run out as Pakistan put themselves well on course for victory over Australia in Abu Dhabi on day three.
Azhar threw his wicket away comically for 64 at Sheikh Zayed Stadium, Mitchell Starc zipping in a throw and Paine whipping off the bails as the number three casually chatted to Asad Shafiq out of his ground thinking he had struck a boundary.
There was also agony for Babar when he was dismissed for 99, but Pakistan should have the last laugh after declaring on 400-9 to set the tourists a highly unlikely 538 to win.
Usman Khawaja's magnificent century denied Pakistan in the first Test, but he was unable to open due to a knee injury on Thursday and his replacement, Shaun Marsh, fell cheaply as Australia were reduced to 47-1 at stumps.
Sarfraz Ahmed (81) earlier made a second half-century of the match, with Nathan Lyon taking 4-135 on a gruelling day for Australia.
Lyon struck in the sixth over of the day with a flighted delivery which deceived an advancing Haris Sohail, who was stumped by Paine.
Azhar followed in bizarre fashion soon after to leave Pakistan 160-4, but Babar and Shafiq capitalised on an excellent batting surface in a stand of 75.
Shafiq was twice dropped by Marnus Labuschagne at short leg off Lyon before the all-rounder dismissed him for 44 in the afternoon session.
Babar had brought up his half-century and continued to tick along effortlessly, launching Labuschagne for six over long-off before Sarfraz did the same to Lyon straight after sweeping him to the boundary.
Peter Siddle rattled Sarfraz on the helmet, but the skipper brought up his second half-century of the match and Babar was on the brink of a first Test hundred when he was trapped leg before by Mitchell Marsh.
Babar reviewed, in hope more than expectation, but was sent on his way after hitting three sixes and another six boundaries in an excellent knock, putting on 133 for the sixth wicket with Sarfraz.
Bilal Asif smashed Labuschagne's first ball after tea for a straight six, but he and fellow spinner Yasir Shah fell in the same Lyon over, much to the frustration of Sarfraz.
Sarfraz decided it was time to deal in boundaries, but missed out on a hundred again when Labuschagne snared him leg before and declared soon after trudging off.
Stand-in opener Shaun Marsh failed for the fourth time in the series, bowled by a peach of a delivery from Mir Hamza which nipped away and struck the top of off stump.
Aaron Finch and Travis Head prevented any further damage from being done, but Pakistan have two days to take the nine wickets needed to win the series.
|Wozniacki enjoyed status as defending champion in Melbourne|
|Solskjaer backs Mourinho to return to football´s big time|
|Murray to miss Open 13 Marseille|
|Solskjaer´s United turnaround no easy task, says Hughton|
|The big Friday Premier League quiz|
|How James Harden´s 2018-19 numbers compare to his MVP campaign|
|It´s insane! - Tsitsipas excited to face ´legend´ Federer|
|Sharapova ends Wozniacki title defence|
|American teen Anisimova sends records tumbling at Aus Open|
|Lakers survive Ball´s gaffe to beat Thunder in OT|
|Federer expects ´athletic´ and ´attacking´ Tsitsipas clash|
|Alcacer is fit and available – Favre|
|Fantastic Federer breezes past Fritz|
|Pogba happy with Man United approach under Solskjaer|
|Mickelson leads Desert Classic, ties career-low with 12-under 60|
|Warriors´ Durant on Curry: He´s a once-in-a-generation, once-in-a-lifetime talent|
|Patriots owner says Brady is greatest player, not just quarterback, of all time|
|Inglis to retire from representative duty this year, NRL in 2020|
|Is Beal better without Wall? Wizards star says it´s ´absolutely nonsense´|
|Rockets C Capela undergoes thumb surgery, expected back after All-Star break|
|This Week in U.S. Sports: Irving apologises, Machado´s agent isn´t happy|
|Knicks in woeful shape, but 2019 could still be bright in New York|
|Valverde not worried about Levante´s Copa appeal|
|Nowell an option for England at flanker, reveals Jones|
|Pellegrini: Arnautovic available for the right price|
|Knicks throw away 19-point lead and lose on last-second goaltending call|
|Tebow invited back to Mets´ major league spring training|
|Canelo and Jacobs agree unification fight|
|Barcelona 3 Levante 0 (4-2 agg): Dembele at the double as Barca advance|
|Levante to lodge complaint over Barcelona Copa selection|
|Kanter´s London absence ´very unfortunate´, says NBA commissioner|
|NBA could swap London for Paris in 2020|
|Spurs coach Popovich uncertain if he will return next season|
|Pistons´ Griffin fined for verbal abuse of official|
|Everton do not have financial conditions to enter transfer market - Silva|
|Andy Cole joins Sol Campbell´s coaching staff at Macclesfield|
|Atletico confirm Saul has thigh injury|
|Wood replaces injured Stone in England squad|
|Lebanon 4 North Korea 1: Disciplinary record cruelly denies Radulovic´s men|
|Saudi Arabia 0 Qatar 2: In-form Ali bags brace as Qatar top group|
|Robertson signs new Liverpool deal|
|Vunipola backs Farrell to thrive in solo leadership role|
|People don´t know what´s going on behind the scenes - Mourinho defends United stint|
|Indefatigable Muguruza knocks out Konta at 3:12am|
|Serena coasts, difficulties for Halep and Muguruza´s marathon|
|Lowry retains Abu Dhabi lead|
|Djokovic battles past Tsonga, young guns flourish|
|Louisville airport to be renamed in Muhammad Ali´s honour|
|Emery not thinking about Ozil speculation|
|Sri Lanka hopeful over Kusal Mendis finger injury|
|Oman 3 Turkmenistan 1: Last-gasp Al-Musallami guarantees progression|
|Emery wants Cech to end career ´in a good moment´|
|Japan 2 Uzbekistan 1: Shiotani stunner seals comeback and top spot|
|Calhanoglu deal ´financially impossible´ for Leipzig|
|Not seen at Aus Open since Nadal, Djokovic and Murray in 2009 – ´Next Gen´ make move|
|Martial: Solskjaer lets me express myself|
|Djokovic sees off Tsonga to reach third round|
|Returning Cousins calls Warriors ´the most hated team in sports´|
|Halep injury ´nothing dangerous´|
|Warner picks up elbow injury in Bangladesh|
|Mkhitaryan returning to Arsenal training next week|
|Leeds United pounce for Real Madrid goalkeeper Casilla|
|Watson lights up Gabba before power cut forces abandonment|
|Superb Serena blows Bouchard away|
|Tevez, Hulk, Oscar, Lavezzi - how the CSL stars Dembele is following to China fared|
|Thiem retires from Australian Open|
|Osaka ´not telling´ when it comes to injury niggle|
|Fabinho enjoying Klopp´s management style|
|Halep battles past Kenin in Melbourne|
|Hartley to miss England´s Six Nations opener|