Sudden shutdowns, system freezes and sudden reboots are often caused by heat issues, or power issues. So first, you need to inspect the interior of the case to ensure it is free of heat trapping dust and dirt, and all the fans spin freely.
Use a hardware monitor to monitor your temps.
Your motherboard utilities disk should have a monitoring program (or check for a more recent version on your motherboard or PC maker's website). If none, I use and recommend
CoreTemp for newer Intel and AMD64 CPUs, or
RealTemp for Intels.
SpeedFan is a great and popular alternative,
or you can try
Motherboard Monitor.
Open Hardware Monitor is also becoming very popular. Unfortunately, I have found that these programs often have problems properly identifying and labeling the sensor they are reading. The temperatures shown are as accurate as the inexpensive, low-tech sensors will allow, but it may say System Fan instead of CPU Fan. Fortunately, the programs do allow you to edit the labels, so I use
Everest to verify the temperatures (as it is able to match sensor with label correctly), then edit the label in the monitoring program. In Everest, look under Computer > Sensor, then wait a couple seconds for the readings to appear. Unfortunately, Everest does not minimize to the system tray to show real-time temperatures, otherwise, you could use Everest instead of the others. Check but do not rely on the temps shown in the BIOS Setup Menu. While they are likely correct, running the BIOS Setup Menu is probably the least demanding task you can ask of your computer so it does not show the temps when the system is being taxed. But if the BIOS Setup Menu temps are high, you have a problem that needs to be corrected.
HWMonitor, from the makers of CPUID is also very informative, but does not minimize to the system tray.
I get nervous when CPU temperatures hit 60°C. While most CPUs are capable operating at higher temps, system stability issues arise and long term exposure to very warm temperatures increases component aging (including the CPU socket and surrounding devices). GPU (graphics processing unit) temperatures typically run considerably warmer with 80°C not uncommon.
If your temps are normal, I would want to know my power supply is working properly by swapping in a known good one, or having that on properly tested.
You may also try running with one stick of RAM at a time. Just be sure to unplug the computer from the wall AND touch bare metal of the case interior to discharge any static in your body BEFORE reaching in for cleaning or pulling parts.