Pakistan will have been further bouyed as they managed to pick up the early second innings wicket of captain Andrew Strauss when was caught in the slips by Yasir Hameed off left-arm quick Mohammad Aamer for four.
England finished the day on six for one.
Pakistan were well-placed initially thanks to resolute batting, notably a fourth-wicket stand of 69 between recalled former captain Mohammad Yousuf, who made 56 on his return to Test cricket, and Ali.
Yousuf, appearing in his first international match in several months after he was handed an indefinite ban by the Pakistan Cricket Board (PCB) for his role in captaining the team on their winless tour of Australia, was the epitome of unruffled calm.
Pakistan had been dismissed for record low scores of 80 and 72 in crushing defeats by 354 runs and nine wickets in the first and second Tests respectively.
|Pakistan's Salman Butt watches as England's wicketkeeper Matt Prior catches the ball [AFP]
But the 35-year-old Yousuf, Pakistan's third highest run-scorer, never looked flustered despite having played just a handful of matches during his international "retirement".
He found a willing ally in Ali, 10 years his junior, who only made his debut on this tour and whose best score in four previous Tests was the 51 he made in Pakistan's dramatic three-wicket win over Australia at Headingley last month.
Ali was the first to acknowledge Yousuf's role in his near five-hour innings, which spanned 176 balls and included 14 boundaries.
"Mohammad [Yousuf] was very helpful. When I was in the middle he was guiding me, calming me down, saying: 'Just stay in and the runs will come."'
Meanwhile Pakistan captain Salman Butt said: "Azhar played wonderfully well.
"We have been talking about Pakistan's future a lot and what I've been telling you guys [the media] was finally on show," he said after Ali was left eight runs shy of a century when last man Mohammad Asif holed out against .
Butt though was equally glad of Yousuf's contribution, which he likened to that of now retired former Pakistan captain Inzamam-ul-Haq.
"He is the most stylish player in the modern era because when he's batting it seems there's a lot of time for the batter, no matter how quick the bowler it looks easy, like Inzamam used to be."
Swann moved past 100 wickets in only his 23rd Test as he led England's attack, but he accepted Pakistan had the upper hand.
"There's no doubt about it, we're behind the eight ball a little bit because of the deficit, but it's still a cracking batting track," he said.
Swann had the satisfaction of dismissing Yousuf, caught and bowled, for his 100th Test wicket.
"It was the first time I've played against him and he played like the class player he is," Swann said. "So to get him as my 100th is great."
The 31-year-old Swann has had a see-saw week.
He started it in court answering a drink-driving charge but now has a chance of being named the world's best player after the International Cricket Council belatedly added his name to their 16-man longlist of candidates for the award.
"I saw on TV that I was on the list and I was expecting congratulations in the dressing room but all I got was the mickey taken that I wasn't in to start with," Swann explained.