Macbook Pro turning off in sleep mode Since upgrading to the latest MacOS my Macbook Pro seems to be turning off while in sleep mode if left for a long time, I think only when it's not plugged in. 

If I close the lid and open it up in about 10 mins, it'll come out of sleep as expected and ask for my password. However if I close the lid and leave it for a few hours, I need to press the power button to boot it back up again asks for HDD encryption password and then prompts to log in.

I have tried resetting the NVRAM and SMC but no luck. There are no further MacOS updates.

Any idea what else I can try?
My iMac began shutting down at random in sleep mode. As it was 6 years old I assumed that the power supply was packing up causing overheating and shut down.

Was about to rush out and buy a new one but had a specialist look at it first. It turned out to be software,  freebie malware and avast. Once removed machine runs fast,like new, and doe not shut down. Object lesson look before you leap!