BIRMINGHAM: Azhar Ali's century helped keep England at bay before he was out to the final ball of the second day of the third Test at Edgbaston on Thursday.
Azhar's more than six-hour 139 ended when all-rounder Chris Woakes, on his Warwickshire home ground, struck with the new ball to have him edging to England captain Alastair Cook at first slip.
That left Pakistan 257 for three at stumps, 40 runs behind England's first innings 297.
Number three Azhar had come in just five balls into Thursday's play after Mohammad Hafeez had fallen for a duck to leave Pakistan none for one.
Azhar punished England for dropping him twice with his 10th century in 48 Tests.
Together with recalled opener Sami Aslam, who made 82, he put on 181 for the second wicket.
Aslam, a 20-year-old left-handed opener, was in sight of a well-deserved maiden Test hundred when he was run out responding to Azhar's poor call.
Younis Khan was 21 not out, having helped Azhar add 76 for the third wicket.
England's tough day in the field was made worse when James Anderson was twice warned officially in one over by Australian umpire Bruce Oxenford for running on the pitch.
One more such warning and Anderson, England's all-time leading Test wicket-taker, would be barred from bowling again in the innings.
Pakistan had seen Sohail Khan, one of their two changes from the side beaten by 330 runs in the second Test at Old Trafford as England levelled the four-match series at 1-1, take a Test-best five for 96 on Wednesday.
Sohail justified both his inclusion, and Pakistan captain Misbah-ul-Haq's decision to field first.
After the 32-year-old paceman sparked a top-order collapse, England were indebted to left-handers Ballance (70) and Ali (63) for getting them close to 300.