My phone's wifi keeps switching itself off
In the WiFi settings, in the advanced tab there's an option that let's you decide when do you want the wifi to be turned on; make sure always is selected.

If that's not the case then you should better check your installed apps. An app (provided the right permission is given) can toggle the wifi switch.