South Africa reached 161 for five before tea on the third day to win by five wickets and claim the series 2-1.
The result kept intact South Africa's record of never losing a series at home to a team from the Asian sub-continent.
Kallis scored 51 in a fifth-wicket stand of 117 with Prince, who was 59 not out.
The partnership was the biggest of a match in which 32 wickets fell on the first two days.
Pakistan were dismissed for 157 in their first innings. South Africa replied with 183.
The visitors were dismissed for 186 in their second innings.