An app may occasionally create software instability, resulting in the phone turning off itself. If the phone only turns itself off when using particular apps or carrying out particular actions, this is probably the problem. Remove any battery-saving or task-management applications.