Xiaomi aqara loosing connection every couple hrs

It highly likely that you have a wifi and zigbee interference. They occupy the same radio space. JD posted a good link at the thread below. You will likely need to change the channel on your wifi. If your neighbor has a strong wifi on the wrong channel you may need to resort to the hub reset.