What games do you play usually? if they use high end graphics, your computer probably has overheated and has shutdown to prevent damage to gpu and other components.
Another possibility is that too much dust has prevented your cpu fan to stop working properly. Either clean up your fan or get an external cooling fan for your computer.
If both of these don't apply to you, then maybe your pc specs aren't good enough for your games and the system stopped responding? To test this, try games that are about 6 or 7 years old (try GTA:SA or VC), and see if it still shuts down. if it does, there is definitely overheating or fan problem (maybe even problem with gpu hardware?). if not, get a better graphics card if want to play new games.