With de Kock on 63 and Bavuma on 61, the tourists need a further 51 runs to overhaul New Zealand's 268.
After struggling against Jeetan Patel in the drawn first Test, de Kock had the New Zealand off-spinner's measure in Wellington apart from one close call, on two, when a cut shot passed narrowly over the top of the stumps.
His timing and confidence grew from there, taking a four and six off successive Tim Southee deliveries and meting out the same punishment to Neil Wagner as he raced to his eighth Test 50 in 55 balls.
Medium-pacer Colin de Grandhomme had put New Zealand on top before lunch with the key wickets of Hashim Amla for 21 and Faf du Plessis for 23.
But, with only one further wicket needed to expose the South African tail and claim command of the Test, they were foiled by de Kock and Bavuma who have put on 124 for the seventh wicket.
Bavuma had a life on five when he skied a Wagner bouncer and de Grandhomme slipped when moving to take what should have been a regulation catch.
Batting more cautiously than de Kock, Bavuma faced 88 deliveries before he notched his sixth half-century pushing a Wagner bouncer through cover for two.
All-rounder de Grandhomme, who won selection more for his batting prowess but contributed only four, has compensated with the ball taking three for 33.
Southee has figures of two for 65.