Almost everyone who has modem for his/her internet connection would have had this problem at some point of his/her (internet) life: modem hang. If you don't already know what is it, it's the problem of not being able to connect the internet but is solved merely by switching off and on the modem (or commonly called resetting the modem or modem reset).
I too had the same problem started a few days after the Unifi installation. I too, took the same solution for weeks: modem reset. Then I realized that the USB port on the modem (intended for programming the modem) is just like any other USB port. So...
I plugged in a cheap laptop cooling fan to that USB port. The modem is switched on almost 24/7. It is in an area without air conditioned; in fact the area have slightly higher temperature compare to the rest of the house during midday. I switched the modem off just to give it a break for 5 minutes or so, every 4 or 5 days. It has been more than a year now, I still use the same modem that they first installed and have no more "modem hang" problem!
I'm not sure if the newer modems come with that USB port. Good luck!