As you probably know, hard drives have a spinning needle that spins in order to reach data and do operations such as saving files, and so on. This spinning requires energy and too much spinning can wear off your hard drive.
Therefore, there is an option called HDD sleep. This option allows you to stop your hard drive from spinning when you are not using your Mac so you can save energy and prevent deterioration of your hard drive, which prolongs its lifespan.
To activate this option all you need to do is:
Click on the Apple menu on the top left of your screen and select System Preferences
Open Energy Saver by clicking on the light bulb icon
Check the Put hard disks to sleep when possible box
Now you have all the information you need to stop Mac from sleeping without any additional tools or special knowledge needed!