If Windows' event viewer says no more than that the system wasn't correctly shut down (and didn't tell what happened to cause it to shutdown) and there was no blue screen with an error number, a common issue is heat:
- check the fans
- clean the inside of the case
- don't overclock
- renew the heat paste around the CPU
Hello, my computer shuts down randomly especially when I am in the middle of doing something then it also opens automatically. What's wrong?

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic