MQTT disconnects after few hrs

I am publishing data and subscribing via MQTT server with help of EG25 module.I haven’t used any external libraries in code, it runs only AT Commands.Everthing works fine for fews hrs after that it disconnects from mqtt server. I even checked my MQTT server side but it has not problem.How to reconnect to mqtt sever when its get disconnected?

Setup:

Atmega 2560
EG25-G
Baud rate - 115200


Therefore, you need to configure larger Keepalive times, or periodically send PING heartbeat packets to the MQTT server