I finally figured out the Laptop randomly goes to sleep issue (I’m not allowed to post link to the old/closed thread).
The randomness is what happens to the lid. My power settings (set by right click on the battery symbol) tells the laptop never to standby. It also tells the lid close action to switch off display (which also locks the session). When the lid is closed, that is exactly what happens - laptop goes to lock screen, display is switched off. When I open the lid later, display goes on and I see the lock screen.
Problem is - when the lid is closed slowly, or something is stopping the lid from closing all the way, or disturbance of the lid close signal. The point is. When lid sensor says close, display is switched off.
When lid sensor says open (disturbance, or lid actually opens), lock screen is shown.
When lid sensor says close again, pc goes to standby. Problem seems to be that power settings at lock screen are different from power settings with active session.
How can the power settings that applies to the lock screen be changed?