Build a PC PC shuts down when playing games

This is my problem:

My pc shuts down if i play games like: Dungeons and dragons online, call of duty 4, Medal of honor 2011.

I read some other treads about computers shutting down when games were played but those treads were shut down so i had to make a new tread.

I hope you guys can help me a bit!

Specs:

intel core i7 first generation
4 GB RAM
Nvidea Gainward GTS 450
ASrock x58 motherboard
1Tera Hitachi HD
500W powersupply <-------------i tink this is the problem but i'm not really sure

Speedfan is telling my:

GPU temp:40 C
cores are around:45C
 
I agree, you should check your power supply but also try to do some research on those games and make sure that their safe to have on your PC because they could contain a virus and that could really harm your PC.