1. Clear the vents
Turn the laptop off and check the air vents and fan grille for dust. Use short bursts of compressed air to clear them, and keep the laptop away from soft surfaces such as beds.
2. Find the heavy processes
Open the task manager or activity monitor and sort by CPU use. Close or uninstall programs that stay busy in the background without good reason.
3. Change the power mode
Switch to a balanced or power-saving mode, and reduce the number of browser tabs and video streams. Use a stand or a cooling pad for better airflow.
4. Seek a repair if needed
If the fan is loud and the laptop still shuts down, the fan or thermal paste may need replacing. Ask a repair shop, as opening the case can void the warranty.