Solution is right click on my computer -> properties -> advanced tab -> under start up and recovery, click settings -> under systems failure uncheck the option automatically restart.
The problem is causing due to old computer configuration
i guess u might have P3 or P4 processor with 512RAM and one Fan on your Tower (CPU).
Before it re-starts just check your CPU will make a buzzing noise and restarts/Shut down.
Upgrade your RAM, before upgrading just Check if your mother board supports the upgrade you are doing.