Have you noticed a specific pattern of restart such as at specific time. If so may be it is because of Auto restart being ON. To turn it off Open Device Care, on top right you'll see three dots tap on it and select Auto restart, see if it is on and certain times are enabled. Turn it off and it should stop to restart on it's own or you can set it to restart at certain day or at time as Samsung recommends to restart phones in certain period of times for better performance.
If my post has been beneficial to you, please don't forget to Like my post. If my reply resolved your questions or issues✅, please Mark it as solution by pressing the "✓ Accept as Solution" button.