President Erdogan was reacting to a non-binding vote by the European Parliament to freeze talks on EU membership for Turkey, BBC reports.
The MEPs were alarmed by Erdogan’s “disproportionate” response to a failed coup attempt in July.
Attempts to get visa-free travel for Turks stalled as the country refused to change its anti-terror laws and many in Europe have criticised Turkey’s tough response to the failed coup.
The migrant numbers reaching the Greek islands have dropped since an EU-Turkey deal in March to curb the influx.
President Erdogan accused the EU of breaking its promises. As part of the March deal, Turkey was promised aid, visa-free travel for its nationals and accelerated membership talks.
“Listen to me: these border gates will be opened if you go any further,” he warned the EU on Friday.
A spokeswoman for German Chancellor Angela Merkel, Ulrike Demmer, said the deal was in the “interest of all parties” and that “threats on either side are not helpful”.
Turkey currently hosts almost three million migrants, mostly from Syria. Last year more than one million fled to Europe, mainly via Turkey.
Under the March 2016 agreement, migrants arriving in Greece are now sent back to Turkey if they do not apply for asylum or their claim is rejected.
For each Syrian migrant returned to Turkey, the EU is to take in another Syrian who has made a legitimate request.