The Boks were the first to get the scoreboard ticking in the second half when hooker Bongi Mbonambi powered over the try line after a well-taken driving maul.
The try was more about relief for the Springboks as it came shortly before Biggar was to return to the field after he saw yellow three minutes before the halftime break.
The Springboks reduced the deficit with a try by Malcolm Marx that was a result of another powerfully taken driving maul but another penalty saw Biggar put away his third penalty.
Biggar scored another penalty as they further increased their lead but the Boks roared back into the match with a Cheslin Kolbe try that was converted by Damian Willemse.
The Boks were awarded a penalty try before Dewi Lake levelled the scores but Willemse proved the decider with his late penalty.
Springboks (3) 23
Wales (18) 29
Tries: Bongi Mbonambi, Malcolm Marx, Cheslin Kolbe
Conversions: Damian Willemse (2)
Penalties: Elton Jantjies (1), Damian Willemse (1)
Tries: Louis Rees-Zammit (2), Dewi Lake
Conversions: Dan Biggar (1)
Penalties: Dan Biggar (3)
Drop Goal: Dan Biggar (1)