I can think of three possible problems:
1. PSU is going bad. If it is still halfway good it can boot past BIOS but once the HDD, CPU and memory start to work it will stall.
2. Memory is bad or needs to be reseated.
3. HDD is failing. Feel the HDD while the PC is running. If it feels too hot thn it could be dying. Also google Spinrite and run it to test the HDD. If the test starts then the PC shuts down, its PSU. if it doesn't shut down during the test then that should see if your HDD is going bad.