Hi there Deepak_94,
Thanks for reaching out to the Apple Support Communities. Just to confirm, when this issue occurs are you getting an alert showing that your MacBook restarted because of a problem? If not, then there may not be a kernel panic log to review.
If it does, we'd recommend going through the steps in the following resource that can help with troubleshooting this issue further: If your Mac restarts and a message appears - Apple Support
If your Mac restarts unexpectedly, an error known as a kernel panic occurred, and a message indicates that your computer restarted because of a problem.
The most likely cause is faulty software. A kernel panic can also be caused by damaged or incompatible hardware, including external devices attached to your Mac.
If the kernel panic is caused by a known problem, the faulty software is identified. To make sure that this software doesn’t continue to cause kernel panics, move it to the Trash.
If the faulty software is not identified and your Mac continues to experience kernel panics, try the following:
- Restart your Mac in safe mode. If it successfully starts up in safe mode, choose Apple menu
> App Store, click Updates, then install any available updates.
- Uninstall any plug-ins or other enhancement software from manufacturers other than Apple. If you recently updated macOS or an app, plug-ins and other software that worked in the past may no longer be compatible. Read the manufacturer’s documentation (including Read Me notes) to be sure the software is compatible with your version of macOS.
- Disconnect all devices except for an Apple keyboard and mouse. Remove hardware upgrades from other manufacturers, such as random-access memory (RAM) and Peripheral Component Interconnect (PCI) cards. Then try restarting your Mac.
If this resolves the issue, reconnect one device at a time, restarting your Mac after reconnecting each one, until you determine which device is causing the problem.
- Use Apple Diagnostics to diagnose problems with your computer’s internal hardware, such as the logic board, memory, and wireless components. See the Apple Support article Use Apple Diagnostics to test your Mac.
Also, do you by chance use a case or protector with your MacBook? If so, we'd recommend removing any accessories from your MacBook to see if this issue persists. This can help to determine if the accessory may be pressing on the power button unintentionally when the lid is closed.
Let us know what you find after going through the steps above, and we'll continue from there.
Have a great day!