Toggle between tabs for ball-by-ball updates and full scorecard
Report, Day 3: Babar Azam just missed a maiden test century but Pakistan gave itself more than two days to win the short test series against Australia and made a good start on Thursday.
Azam fell for a career-best 99 and captain Sarfraz Ahmed added 81 before he declared their second innings over at 400-9 for an overall lead of 537 runs.
Pakistan delayed the declaration, mindful of Australia escaping defeat in the first test in Dubai last week. Pakistan declared there also, and gave itself just under five sessions to bowl out Australia. But Australia, given an improbable 462 to win, held out with two wickets to spare.
This time, Pakistan has set Australia a monstrous 538 to win in more than six sessions, and already undermined that notion by taking out Shaun Marsh for 4 with an incredible delivery by debutant Mir Hamza.
By stumps on day three, Australia was 47-1, Aaron Finch was on 24, and Tim Head on 17.
Pakistan suffered a late collapse but its lead had already passed 500.
It resumed from 144-2 overnight and the morning session was lowlighted by Azhar Ali's embarrassing run out on 64.
Ali steered a delivery through slips and the ball rolled towards the boundary. Ali didn't run, believing he'd hit a four, and met Asad Shafiq in the middle of the pitch to talk.
But the ball stopped before the boundary at third man, and the chasing Mitchell Starc threw it at the striker's end and captain Tim Paine whipped the bails off.
Ali, playing his 67th test, and Shafiq, playing his 63rd, were dumbfounded while the Australians celebrated a little slice of luck.
That dropped Pakistan to 160-4, but Shafiq, and particularly Azam and Ahmed took advantage of a tiring Australia attack.
Shafiq was the only wicket to fall in the middle session, caught at point for 44.
Then Azam and Ahmed dominated, briskly scoring 133 runs for the sixth wicket. Australia couldn't break the partnership even with the second new ball.
Azam was on 99 when he fell lbw to seamer Mitchell Marsh while trying to play across the line. Azam's disappointment was obvious. His 161-ball knock included six fours and three sixes.
Offspinner Nathan Lyon, burdened with much of the workload, then grabbed two wickets in one over, those of Bilal Asif (15) and Yasir Shah (4).
Legspinner Marnus Labuschagne got Ahmed when the captain missed a sweep and was trapped lbw. Ahmed faced 123 balls and hit five fours and a six.
Lyon finished with 4-135 from 43 overs, and eight wickets in the match.
Marsh was forced to open the innings after regular opener Usman Khawaja injured his troublesome left knee during a warm-up before the third day's play. He didn't field all day and had to drop down the order.
Marsh has struggled in the series, which has ended for him with scores of 7, 0, 3 and 4. The lefthander couldn't cope against the Pakistan seamers, and gave Hamza his first test wicket when he lost his off stump.
With inputs from The Associated Press