How do I get my Samsung S5 to maintain a stable wifi network connection?
Do you have a scheduled Titanium backup? That sometimes turns of my wifi when it runs.

Do an inventory of programs you have installed. A system app will not be turning off your wifi, but one you have installed may be doing that.

Install BootManager (free) and select programs you do not want to run at startup. That would be almost everything.

When the screen times out the wifi may be disconnecting, too, but wifi should automatically reconnect when the phone is unlocked. For testing you might install an app to keep the phone from going to sleep to see if losing wifi is related to sleeping.