Then you add 500 or 1000 numbers to the IN statement, php is great at creating strings :-)
(sql accepts very long queries)
But ofcourse there are more intelligent ways of doing it, because there has to be a reason why those particular records must be deleted.
If that reason is stored in the same table you can just say things like:
delete from table where datefield<date_sub(now(),interval 3 day);
to delete all records that have a date of more than 3 days ago.