Use a free app like HWMonitor or Core Temp to monitor internal temperatures. It's possible that your laptop is overheating and shutting down because of that. As it's four or five years old, the thermal compound may be drying out and cannot adequately transfer heat away from the processor, and there may be a lot of dust inside the laptop and maybe inside the fan and heat fins. So, your laptop is unable to adequately cool itself. That will cause the processor to throttle (slow down). You might consider an internal cleaning. Open it up to clean out dust. Disassemble the fan to clean out dust and fluff. I found a fair bit in two laptops I worked on recently. Remove the heat sink, remove the old thermal compound and apply new thermal compound before reinstalling the heat sink. While you're in there, replace the CMOS battery.BIOS settings and date/time can't be saved without a functioning CMOS battery. Heat and ventilation are issues with pretty well all modern thin laptops. Always use the laptop on a hard surface, never on a bed, couch, pillow, etc. You might want to do what I did: I took a strip of lumber, about 3.5 cm. wide x 2 cm. high (1.5" x 3/4"}, and the length equal to the width of my laptop. I routed out two notches to accommodate the laptop's rear feet. The rear of the laptop sits in those notches, propping up the rear by 2 cm. That provides better ventilation underneath the laptop and makes it easier for the fan to draw in air via the bottom vent.  It's cheap insurance, and also positions the keyboard at a slight angle that makes typing more comfortable. It won't solve a major heat issue, but it helps somewhat. You can also reduce heat caused by Turbo Boost by changing power settings.Settings | System | Power & Sleep | Additional power settings | select your plan | Change plan settings | Change advanced power settings | Processor power management | Maximum processor state: set to 99% or lower.If you set it to anything below 100%, Turbo Boost will not activate, so system will not generate as much heat and you will save battery power. Whenever touching components or working inside a computer, wear a grounded wrist strap, also called anti-static wrist strap, ESD wrist strap, or ground bracelet. It's a cheap and sensible precaution. Rest the laptop on an anti-static mat or at least a reasonable alternative such as corrugated cardboard. (Repeatedly touching a metal case part is not sufficient mitigation with modern components.)
My laptop is XPS 13 2018 and a while ago it started to go to hibernation mode suddenly after minutes of turning on the laptop with no errors at all.  I tried to look for a solution for this problem and i found that i might need to download Intel Dynamic Platform and Thermal Framework driver to 8.2.11000.2996, A04 and i did. However, nothing changed and my laptop still has the same problem and for this reason I can’t use my laptop properly.    Any advice? 
XPS 13 Sudden hibernation mode