Ali (82) and wicketkeeper-batsman Mohammad Rizwan (22) stitched together an 83-run partnership for the sixth wicket to help Pakistan reach 158-5 at tea, trailing England by 425 runs.
England off-spinner Dom Bess dismissed Fawad Alam in the second session to reduce Pakistan to 75-5 but Ali continued to score runs freely at the other end.
Ali became the fifth Pakistan batsman to reach 6,000 runs in tests before completing his half century in 137 deliveries, which included seven boundaries.
England seamer James Anderson removed Asad Shafiq for his fourth wicket of the innings to leave Pakistan teetering at 30-4 in the morning session, which was interrupted by rain.
Anderson, England's highest test wicket-taker, is now just three wickets away from becoming the first pace bowler to claim 600 test dismissals.
Only spin bowlers Anil Kumble (619), Shane Warne (708) and Muttiah Muralitharan (800) have more dismissals in the game's longest format.
Zak Crawley (267) converted his maiden century into a double ton and shared a record-breaking 359-run partnership with Jos Buttler (152) as England declared their first innings on 583-8 on Saturday.
England, who hold a 1-0 lead, are edging towards their first test series win over Pakistan since 2010.
The hosts won the opening match in Manchester by three wickets, and the rain-hit second game ended in a draw.