Steps:
1. Turn off your iPhone by pressing at the same time power and home button (don't use the slider, keep pressing both buttons till screen collapses).
2. Wait about 30 seconds with your iPhone off.
3. Turn it back on (I had to do it with both buttons pressed).
With this method iPhone has been on without turning off by itself for about 8 hours. This morning it had turned off again, but that's much more than 20 seconds and I had synced it already, don't know if this was the reason why it turned off.
Thanks everyone for the help.
