ESP8266: Make sure everything is send befor sleep?

I have set up a temperature logger with an ESP8266. It wakes up once an hour, and is supposed to send temperature and humidity via MQTT (using the PubSubClient library). I have had this working for a while now and looking at the voltage, I face between 4 month and year run time on a 18650 LiPo, which is totally fine.
The problem I have is that apparently, sometimes the node goes to sleep before the MQTT message is actually send. Initially sending didn't work at all. Then I added a delay of 300ms before the sleep command, and it works mosty, but not always. A Wemos D1 Mini Pro seems to work better than a standard Mini.

Is there a way to determine if there are still network messages to be send?

I'm not sure how you are setup but
I send a GET message to a PHP then when received, the page sends a "Got It" reply which I read before closing the connection.

Yeah, AFAIk that doesn’t exist for the PubSubClient lib. I need a low level function to check if TCP packages have been send or not.