Thanks for letting us know your difficulty and experience with your Samsung Galaxy A13 4G having issues of powering off while in use.
Did you feel your device get hot before the power off? If you do, then its highly probable that in order to protect your device and its internal parts from overheating, it performs power shutdown.
Before you try out the below recommendations as to your solution, be sure to check if your device's software are updated with the latest version. Please check how to update your mobile device's software in the following order.
Step 1. Go to Settings > Software update.
Step 2. Tap on Download and install.
Step 3. Follow the on-screen instructions.
If that doesn't fix the problem, you may submit an error report through the Samsung Members app as follows:
Step 1. Long press Samsung Members icon on Apps screen and tap Error reports.
Step 2. Tap OK on agreement popup to send system log data.
Step 3. Select Symptom category "Power/Battery/Charging".
Step 4. Describe the problem in details and SEND.
Reboot your Phone in Safe Mode.
Using Safe mode disables all downloaded apps and loads only the original settings that came with your phone, allowing you to determine if the issue is caused by an app. On devices with a regular Power key, press and hold the Power key until the Power menu is displayed.