there are various ways to prevent windows from going to sleep, I show you some methods and just select the one that best suits you.
First method: open start menu and select “Settings”
After that select the "System" from the top left corner.
and then select " Power & Sleep" option from left panel.
here is the final step to finish to the job, just set your preferred time in right panel under the "Screen" and "Sleep"