Take Trans-Bridge Bus and spend the night at a JFK hotel.
Or Have someone Drive you there real early in the morning. A limo is also a option. But I've had trouble getting limo to show up at 1am to take me there, and wound up driving.
Best Option is to get a hotel room get a good night sleep and get up and take hotel shuttle over to JFK for your Flight.