As rekabe already mentioned, overheating can be a source of random shutdowns. Add a temperature monitoring widget to your desktop to see what's going on, and read on. There are lots of good hardware tips here so far... let me add a few:
Power Supplies: I can't say enough good things about Antec, and in spades for PC Power & Cooling. Of the two PC Power & Cooling is the more expensive, but worth it. Very clean, very cool running, and more than capable of delivering what the label says and then some. Antec is better price/performance-wise but less heavy duty, and so a good choice for less mission-critical hardware. There are others out there, but those two stand out for me.
Power supplies can cause that "sudden shutdown" kind of problem if they are supplying unclean power to the motherboard (makes CPU and support chips run hotter). A good way to check for this (without resorting to an oscilloscope) is just to monitor the baseline temperatures for your equipment with the power supply under consideration. If you see a sudden sharp rise from baseline, and your heatsink and fan are clean and working, look at the power supply as a suspect. (There are also power supply testers out there that can properly load test a supply without a motherboard, but these require some training to use correctly.)
Hard Drives: I used to be a big Seagate fan, but not so much any more. I've had my best luck lately with drives from Hitachi Global Storage Technologies. I have a 160GB external (it used to serve in my old Gateway laptop) that has been going strong for about seven years now with nary a hitch, and a 500GB in my Dell 620 that is nothing short of rock solid. Both are fast, quiet, and reasonably cool in operation. I also have a 1TB SATA drive in my Precision 690 that is diabolically fast, quiet, and has been reliable so far under conditions I can only describe as "quite demanding" (my 690 is the test-bed I'm using for PCLinuxOS 64-bit and a few other, more radical things).
Go for higher spindle speeds and larger caches on magnetic drives, as these will make a major difference in system throughput.
Heat Sink/Fan Units: For most systems, these do not have to be anything special, but good quality units installed correctly with ball bearing or magnetically levitated fan types are quieter and more durable in service. The really important things when installing a sink are getting proper thermal coupling (a fresh smear of high quality couplant paste such as Arctic Silver or a new heat transfer pad is essential whenever removing/replacing a heatsink). If you are using a heatpipe type assembly, check the heatpipes for cracks before installation, as these will impair the sink's ability to transfer heat. Good heatsinks for normal use are available from a wide variety of vendors, but if you want high-end performance, look at those from Thermaltake, Zalman, and Scythe.
Always check the rotation of the fan on your CPU heatsink, make sure it turns in the direction the manufacturer intended, and is mounted correctly on the sink.
That's enough for now... don't want to turn this into a tech manual.