Check whether you have Do Not Disturb mode set on a schedule.
Otherwise manually turn the sound back on and watch to see whether it happens again. Some apps can change volume settings (check permissions to see whether you have any, then look at those apps' settings to see whether any of them might have done so), or the volume key might have been accidentally pressed in a pocket. Just the fact that it's gone silent doesn't tell us much.