Left-arm spinner Nauman Ali took 5-35 for the hosts while Yasir Shah finished with 4-79.
Temba Bavuma was the last man out for 40.
Earlier, the Proteas had resumed their second innings on 187 for 4, holding a lead of 29 runs.
The second Test starts on February 4 in Rawalpindi.
For more news your way, download The Citizen’s app for iOS and Android.
Download our app and read this and other great stories on the move. Available for Android and iOS.