Laptop seems to go into standby mode randomly (by itself)

Electromagnet triggers sensor

The "close lid" function, which puts the laptop into standby mode by default, is based on a magnetic sensor (so-called Hall sensor), which is located on the front edge of the laptop in most models. If you touch this sensor with a magnet, it triggers the corresponding action. It can happen that you accidentally trigger this sensor with an object on your wrist, e.g. a fitness wristband, a smartwatch or the new "MagSafe" accessories of recent iPhones. This can also occur when the object (e.g. your mobile phone) is in one's pocket and the laptop is used on the lap.

So, if it happens that the laptop sometimes goes into standby mode supposedly "by itself", you should first set the action for "Close lid" to "Do nothing". The fastest way to find the option is to search for the word "lid" in the Start menu. See this screenshot.