(I FOUND A SOLUTION!)
I was having the same problem with my Xbox slim. It would randomly beep a few times and then turn off. At first I thought I had a bad power brick. I replaced it but that didn't fix the issue. I also called Microsoft support but they weren't much help. So I took apart my Xbox and I found out that the ribbon flex cable was damaged. This is the cable that is attached to the on/off and eject buttons inside the front faceplate inside the Xbox 360 Slim Console. All I did was took a Q-tip and dipped it into rubbing alcohol and gently cleaned the ribbon cable. For me, that fixed my problem. If your cable is really damaged and cleaning it doesn't fix the problem, you have a couple options. You can buy a new cable online (around $5) and replace it yourself, or you can just detach the ribbon cable completely. Detaching the cable would mean the front panel buttons will not work. You will have to turn the counsel on/off with your controller. For some this would be annoying but it is definitely less annoying than your counsel randomly turning off in the middle of a game. There are many videos out there showing how to take apart a Xbox slim and also how to replace a ribbon flex cable.
Here is the link for how to take apart the Xbox...
https://www.youtube.com/watch?v=rSD7GPiV6yU
Here is the link for how to replace the ribbon flex cable...
https://www.youtube.com/watch?v=x5WXYkGS8iQ
Here is where you can find replacement flex cables online...
https://www.google.com/search?q=xbox+flex+cable&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a#q=xbox+slim+ribbon+flex+cable&rls=org.mozilla:en-US:official&safe=off&tbm=shop
I hope this fixes your problem. Good Luck!