Hey Sneh1311,
Sounds like you might need some help adjusting your sleep wake settings on your Mac.
If you see that something is preventing your Mac from going to sleep, try closing out of all your open applications before letting it sleep.
For more help, putting your Mac to sleep, please work through these steps:
Put your Mac to sleep
To put your Mac to sleep, do any of the following:
• Choose Apple menu
> Sleep.
• On a Mac notebook computer, close the display.
• If you have the option on your keyboard, press Option-Command-Media Eject key
.
This is outlined in more detail here: Put your Mac to sleep or wake it - Apple Support
If your Mac goes to sleep or wakes unexpectedly, these steps will be best equipped to help with that: If your Mac sleeps or wakes unexpectedly - Apple Support
We hope this information helps out.
Take care!