Thank you for the reply.
As you mentioned that the laptop turns off less when you use it on a flat surface, it can be an overheating issue.
I would suggest you to use a cooling pad which may help you with this issue.
Also, update the BIOS of the system from the manufacturers website. If it is a Dell laptop, let me know the system model.
Refer to the link mentioned below as well:
Thanks & Regards