Ali, who made 133 in the first innings, looked poised to become first Pakistani to a make a Test century pair in six years, after Misbah-ul-Haq achieved the feat against Australia in 2014
South African skipper Quinton de Kock had a miserable 50th Test as he followed his 15 in the first innings with just two, caught off a lazy push off Yasir.
It took Rizwan just 60 deliveries to bring up his sixth half-century, fittingly reaching the mark with a boundary to underscore his aggressive approach despite the green wicket.
Jamieson had the remarkable figures of two for nine off 17 overs at tea but as the Rizwan-Ashraf partnership took its toll he ended the day with three for 35 off 23.1 overs.