You caould have your xbox in an outlet that uses an "on/off" switch. Or maybe xbox has a setting to make it automatically turn off
this same thing happened to me. first the xbox turned off without notice and then when it was on it didnt read any games i tried everything, but the power connection needed to be replaced so i had no choice to ship it to xbox diagnostics, took like a month for those idiots to send it back, but when i got it it was fine and i saw the power cord had been replaced along with the dvd drive. ( oh also does it beep when you turn it on and it goes back off, if so this is most likely the problem) (oh i almost forgot to tell you, if there is any way to backup your xbox hdd without voiding the warranty, do it. the first thing they do is reformat your hdd, like that fixes anything)