Best way to keep ESP8266 node connected to server

I have my multi node system running stably for about 2 years now. However from time to time (once a month) I loose connectivity through the router/gateway. My solution has been to reboot the router/gateway to restore node to node connectivity.

I am wondering what techniques people have used that have 100% reliability?

Here is the detection code I used:

  if(WiFi.status() == WL_CONNECTED) wifiFailCounter = 0;
  else {                                //no WiFi connection
    wifiFailCounter += 1;               //increment
    DEBUG_INFO.println("Lost WiFi ... ");
    if(wifiFailCounter >= (WIFI_TIMEOUT_S/(BLYNK_SEND_INTERVAL_mS/1000))) {
      DEBUG_INFO.println("Rebooting ...");
      if(OTA.running == false) {        //only restart if not in the middle of a OTA
        ESP.restart();                  //reboot if no OTA in progress