This assumes you have windows 10.
Click on the battery icon
Click power and sleep settings
Change the option of "When pc is plugged in, PC goes to sleep after from the default to never
Now it will never sleep until the laptop has been closed or you shut it down yourself.