South Africa were 130 for three at tea in reply to Pakistan's first innings total of 313 on Friday.
Amla (62 not out) and Ashwell Prince (30 not out) put on an unbeaten 77 for the fourth wicket after opening bowler Mohammad Asif, gaining prodigious swing, reduced South Africa to 53 for three.
Makhaya Ntini was mainly responsible for Pakistan failing to get the total in excess of 350 they had hoped for.
Ntini claimed his 16th five-wicket haul as Pakistan paid a heavy penalty for their obsession with hook and pull shots. Ntini took five for 83.
Seven Pakistan batmen succumbed to hook or pull shots.
Pakistan self-destructed in a frenetic morning's play, scoring 71 runs in 67 minutes and 12.5 overs but losing five wickets.
Three wickets fell to hook shots on the first day and the trend continued Friday, with captain Inzamam-ul-Haq the first offender.
Inzamam was out for 42 in the fourth over of the day when he hooked Ntini straight to Amla on the square leg boundary. He stood at the crease looking disgusted with himself before trudging slowly to the dressing room.
Kamran Akmal, who made an aggressive 29, top-edged a pull to mid-on off Andre Nel and Shahid Nazir, who could have been out several times in a hit-or-miss innings of 15, top-edged an attempted hook off Ntini to gully.
Immediately after Nazir's dismissal Rana Naved-ul-Hasan hooked Ntini high to square leg and Amla took a spectacular diving catch but landed over the boundary for the batsman to score six runs.
Danish Kaneria fell to a routine catch at second slip as Ntini took his fifth wicket before Naved-ul-Hasan was the seventh man to be out hooking or pulling, top-edging a pull for Nel to hold a catch off his own bowling.
The tall Asif swung the ball both ways when South Africa started their innings. His first ball to AB de Villiers swung away and the next swung in, with Asif appealing for a catch behind. Replays showed the ball went off the batsman's thigh pad.
South African captain Graeme Smith, who finished the recent series against India with three successive half-centuries, was out without scoring when he edged a ball that swung away from the left-hander to wicketkeeper Akmal.
De Villiers followed in Asif's next over when he edged an out-swinger to Younis Khan at second slip.
South Africa could have been in worse trouble if Amla had been caught on four when Yasir Hameed could not hold a sharp chance at gully off Asif.
Jacques Kallis made 18 before he was Asif's third victim, caught at second slip, but Amla and Prince steadied the innings.
Pakistan 313 (Younis 68, Yasir 63, Inzamam 42; Ntini 5 for 83, Nel 3 for 100) Vs South Africa 130 for 3 (Hashim Amla 62 n o, Ashwell Prince 30 n o; Mohd Asif 3 for 34)