South Africa were indebted to David Miller's 75 not out after their top-order slump.
The two spinners combined when de Villiers departed by slicing Imad to Hafeez at backward point - a wicket greeted by huge cheers from the large Pakistan contingent in a crowd of more than 18,000.
South Africa were in the mire on 118-6 after Hasan had JP Duminy well caught at slip by Babar and removed Wayne Parnell's off stump from the next ball, but they were unable to see the back of the big-hitting Miller.
Because of the poor batting and even not well in the bowling, he went out from the Pakistan squad.
Paceman Hasan Ali led Pakistan's improved bowling performance against South Africa, claiming 3-24 to help restrict the Proteas to 219-8 in 50 overs.
Pakistan defeated South Africa by 19 runs via Duckworth-Lewis method at the Edgbaston on Wednesday.
The Proteas comfortably beat Sri Lanka in their opening match at the global event but Sarfraz says they are motivated to do well.
Opener Quinton de Kock (33), Faf du Plessis (26), Chris Morris (28) and Rabada (26) were the others who got some useful runs.
Pakistan's Shahid Afridi stretches during a practice session ahead of their third One Day International cricket match against Sri Lanka in Colombo June 12, 2012. "The guys are really focused on the next match, [and making sure] that we win the match", Pakistan skipper Sarfraz insists his side have put the India match behind them. Pakistan may, in the end, have won on DLS Method after rain came down in the evening, but they were cruising at 119/3 in a modest run chase of 220.
A boosted up Pakistan team reached Cardiff on Thursday afternoon, with replacement bowler Rumman Raees also joining the team in time for Monday's game.