the factory reset youre talking about put your phone right back to stock correct? where you have nothing on the phone except what it came with when you bought it?
when it shuts down is this while its plugged in or after you unplug it? if its the later then im thinking its a battery issue. pull your battery and examine it closely...see if its slightly bloated..if anything lay it on a flat table and see if you can wobble it...then flip it over and check the other side..
post what you see
does the battery seem to have less and less life to it. does this happen while its NOT plugged in and charging or only while its on the charger at night? im wondering if the phone itself is possibly overheating while on the charger and eventually shutting itself down. have you ever noticed the LED light flashing green/amber?