Needing 191 to win, Pakistan were eight for no wicket at the close.
Opening bowler Asif took five for 76 and leg-spinner Kaneria claimed four for 105 as South Africa were bowled out for 331 in their second innings.
Jacques Kallis made 91 for South Africa. No other batsmen could make a half-century although there were useful contributions down the order, including a last wicket stand of 41 between Andre Nel and Makhaya Ntini.
Asif, Kaneria and Mohammad Sami had to carry a heavy bowling load because of the absence of injured fast bowler Shoaib Akhtar.
Asif sent down 38 overs and Kaneria 51.2, while the less successful Sami bowled 29.
The two key spells of the innings were bowled by Asif, who dismissed both South African opening batsmen on the second day and took the crucial wickets of Kallis and Herschelle Gibbs (40) in a 10-over spell with the second new ball Sunday.
Ashwell Prince was the only batsman dismissed on a morning which yielded 76 runs in 32 overs. Prince was leg before to Kaneria for 22 in the fifth over of the day.
Kallis and Gibbs batted well to put on 78 for the fifth wicket before Asif struck after lunch.
In an over in which he had already had two leg before appeals and beat Gibbs with a ball which went over the top of his stumps, Asif dismissed Gibbs when the batsmen edged a drive low to Younis Khan at second slip.
Asif followed up with the prize wicket of Kallis, who was leg before to a ball which cut back in to him to end a 294-minute, 226-ball innings.
Pakistan could have been in a stronger position if Kallis had been caught by wicketkeeper Kamran Akmal off Kaneria when he had 63. At that stage, 19 overs into the day, South Africa were only one run ahead.
South Africa's last two recognised batsmen, Mark Boucher (46) and Shaun Pollock (36) put on 80 in the best partnership of the match before Kaneria took a return catch when Pollock mistimed a drive seven balls after tea.
Boucher followed five overs later when he edged a drive against Asif to slip. Paul Harris was soon smartly caught at short leg off Kaneria but Nel and Ntini went for their shots and frustrated the tiring bowlers before Ntini was caught at cover off Kaneria.
Shoaib Akhtar, whose four wickets were a major factor in South Africa being bowled out for 124 on a good pitch on the first day, again did not take the field with the Pakistan team.
There was no word from the management about the results of a scan he had on his left hamstring Saturday but it was understood there were discussions about whether Shoaib and fellow injured players Umar Gul and Shoaib Malik should go home. The tour ends with the third Test in Cape Town starting Friday.
Pakistan opening batsmen Mohammad Hafeez and Imran Farhat had to face six overs at the end of the day and survived some hostile fast bowling from Nel and Ntini, although Hafeez played a handsome straight drive for four off Ntini in the final over of the day.
South Africa 124 and 331 (Jacques Kallis 91, Mark Boucher 46, Herschelle Gibbs 40, Shaun Pollock 36, Andre Nel 23; Mohammad Asif 5 for 76, Kaneria 4 for 105) Vs Pakistan 265 and 8/0