1. Bad/Dead battery' Turn on the phone while connected to a charger see if it still turn off by itself if not' the battery should be replaced with a new one.
2, Defective power button can also course this problem most specially if the phone once fell in water or once get wet. Solving this will require disassembling the phone and remove the white plastic covering the board on the keyboard section and clean the board with a methylated spirit. Leave this to a professional technician.
3. Firmware or hardware related issues: if a new battery does not solve the problem' I'm afraid your phone needs service' please visit any local phone repair shop for service.