The South African beat his American counterpart 6-3 7-6(7) in one hour and 47 minutes to meet the legendary Swiss in the next stage.
World number 15 Anderson raced into a 3-0 lead after breaking Sock - ranked 30th - in the second game to establish daylight in the scoreline.
From there, Anderson found himself in little danger of being pegged back as the duo held their respective serve for the remainder of the set.
There was nothing between them after 10 games of the second set as they sat deadlocked on 5-5, with a tie-break on the horizon.
The tie-break also proved nip and tuck, but Anderson pulled out a break of serve in the 16th game to clinch the victory.