Here's the Nokia 5130 Xpressmusic solution that we revive for some request, and this covers on auto shut off and often restart problem. This problem will cause the phone to automatically shut down even without switching it off or touching anything.
In order to fix this problem you may first try to flash, restore or update the device firmware, you may use a higher versions available like flash file rm-495 7.95, we already tested it for Nokia 5130c Xpressmusic.
Sometimes a software calibration doesn't fix the problem, like you succesfully flash the phones firmware many times using your flashing device but the problem still exits. Some problem is cause by a faulty hardware components. The solution below shows some components that if become faulty or cause by an oxidation it will result to auto shut off problem.
The ESD filter resistors on the button switches also cause the problem if damaged or oxidized. Visually check it, clean it, replace or remove it, the phone will still work without it.. but much better to replace it for it is an ESD protection components.
The keypads ESD/EMI filter if shorted or oxidized, it will cause the phone to hang up or frozen and the keypads doesn't work and also shut off the phone, it is because the power key is also connected to it.
You may clean it first, or rework it.