— Sun Tzu ancient Chinese military general, strategist and philosopher from the Zhou Dynasty -543 - -495 BC
This has often been attributed to Sun Tzu and sometimes to Petrarch. It comes most directly from a line spoken by Michael Corleone in The Godfather Part II (1974), written by Mario Puzo and Francis Ford Coppola:
My father taught me many things here. He taught me in this room. He taught me: keep your friends close but your enemies closer.
Niccolò Machiavelli, who is also sometimes credited, wrote on the subject in The Prince:
It is easier for the prince to make friends of those men who were contented under the former government, and are therefore his enemies, than of those who, being discontented with it, were favourable to him and encouraged him to seize it.