My wifi keeps turning itself off
The doze documentation strongly suggests WiFi is turned off intentionally to save power.

If a user leaves a device unplugged and stationary for a period of time, with the screen off, the device enters Doze mode. In Doze mode, the system attempts to conserve battery by restricting apps' access to network and CPU-intensive services.
The following restrictions apply to your apps while in Doze:

Network access is suspended.
The system does not perform Wi-Fi scans.


If you want to keep your WiFi on, you could leave your phone plugged in overnight.