If your Windows computer crashes or freezes when it "wakes up" from sleep mode or hibernation, disabling power-saving mode should help solve the problem (but if you use laptop you need to plug in the AC Adapter more often).
To disable power-saving mode:
Start -> Control Panel -> (Hardware and Sound) -> Power options -> Change plan settings (on the right side of the selected power plan - Balanced or High Performance) -> Change Advanced settings -> Expand the hard disk power options, by clicking on the "+" next to Hard Disk.
Change the time listed under Turn Off Hard Disk After to Never. Do the same for the Sleep, Hibernate After options.
Computers get hot. Everything inside a computer generates heat, and heat can cause component instablility (RAM, CPU and etc.) and crash your PC.
If the computer case is too hot, check if all your fans are spinning properly (you know by listening closely: do they make a sound?). Make sure that all of your computer's vents, grates and filters are unhindered by dust, pet hair, and other materials that prevent proper airflow. If you find any problematic areas, use a can of compressed air to clear the airways.
If you use a laptop, make sure to place it on a hard, flat surface that won't "smother" the chassis around its vents, thus restricting airflow.
Note: Be very careful while you are cleaning your computer because it is possible that you detach something (usually the SATA cables in desktop-computer cases are prone to detatching). Double-check everything before you turn your computer back on.
Why does my phone keep freezing up? Why does my computer keep freezing up? The answer is the same in both cases - too many temp files may slow down and even crash your device's operating system (learn how to clear your cache).