Check your power settings. (control panel... power options... change plan settings... change advanced plan settings) and make sure all settings are set correctly.
Next I would try connecting via Ethernet instead of WiFi and see if it does or doesn't shut down then. If it works on Ethernet, then the WiFi card is probably going bad. It would need replacing the internal one, or you can get an external one that connects via a USB port.