The 14th seed won their third round clash 6-3, 3-6, 6-3, 6-4.
Cilic now holds a 5-1 head-to-head advantage over the South African No 1.
Cilic will next face Frenchman Gilles Simon in the Round of 16.
Results on Sunday from the seventh day of the US Open, the final Grand Slam tournament of 2014 (x denotes seeded player):
Men
Third round
Tomas Berdych (CZE x6) bt Teimuraz Gabashvili (RUS) 6-3, 6-2, 6-4
Dominic Thiem (AUT) bt Feliciano Lopez (ESP x19) 6-4, 6-2, 6-3
Marin Cilic (CRO x14) bt Kevin Anderson (RSA x18) 6-3, 3-6, 6-3, 6-4
Gilles Simon (FRA x26) bt David Ferrer (ESP x4) 6-3, 3-6, 6-1, 6-3
Gael Monfils (FRA x20) bt Richard Gasquet (FRA x12) 6-4, 6-2, 6-2
Grigor Dimitrov (BUL x7) bt David Goffin (BEL) 0-6, 6-3, 6-4, 6-1
Roberto Bautista Agut (ESP x17) bt Adrian Mannarino (FRA) 7-5, 6-2, 6-3
Roger Federer (SUI x2) bt Marcel Granollers (ESP) 4-6, 6-1, 6-1, 6-1
Women
Fourth round
Belinda Bencic (SUI) bt Jelena Jankovic (SRB x9) 7-6 (8/6), 6-3
Peng Shuai (CHN) bt Lucie Safarova (CZE x14) 6-3, 6-4
Caroline Wozniacki (DEN x10) bt Maria Sharapova (RUS x5) 6-4, 2-6, 6-2
Sara Errani (ITA x13) bt Mirjana Lucic-Baroni (CRO) 6-3, 2-6, 6-0