Same thing was happening to me. Apparently it is the Wi-Fi chip coming loose inside and losing connection. You may also experience a problem where the WiFi will start working all of a sudden then shut off after a bit. I had to get a replacement phone because of this.
Hope that helps.