The visitors, resuming on 425-7, added a further 60 runs before they declared on 485-7 with Steven Croft, 104 not out overnight, reaching an unbeaten 154.
Surrey, struggling at 49-2 when Pietersen arrived, ended the day on 430-5 with Pietersen unbeaten on 234.
He hit eight sixes and 30 fours in his 190-ball innings as a stunning 495 runs were scored on day three at Guildford.
Zander de Bruyn weighed in with 94 and Jason Roy scored 38 as Surrey, seventh in the Division One table, claimed maximum batting points for the first time this season.
The hosts needed to reach 336 to avoid the follow-on and they looked in trouble when Rory Burns was out first ball before Zafar Ansari (21) was also dismissed cheaply.
But Pietersen warmed up for next week's first Test against South Africa with the highest score by any batsman in the 2012 County Championship season.
His next target will be to pass the highest score of his career, the 254 not out he made for Nottinghamshire against Gloucestershire in August 2002.