iPhone 5 won't wake up

I’ve had this iPhone 5 for a few years now and up to now has been problem free. Lately though on some occasions after being on charge overnight the next morning I find that it’s turned off in that it won’t wake up. The only way it can be started is while leaving it on charge is to hold both the home and the on/off down and eventually it restarts. When started it shows 100% charge.
Done a erase and restore within iTunes but that hasn’t helped.
Only does this when on charge.