This used to happen with a friend of mine. She had a laptop, and her mouse was always turning on and off. She had a problem with her USB port, it was too loose.
My Logitech G500 mouse and Razer Lycosa keyboard turn on and off sporadically. To the best of my knowledge, this does not happen to any other USB devices, but I usually don't have more than my mouse and keyboard connected. I can hear the Windows noise that sounds when an external device is plugged in or taken out. My mouse may need replacing because it does not work when the cord is angled in certain ways, but the keyboard is very new. I've tried changing USB ports, and re-installing device drivers. I have also tried to unplug my USB headers from my motherboard because of a separate issue that I suspected could have been related to the issue. (The previous issue: I accidentally broke some of my front USB ports physically, and shortly thereafter started receiving random power messages along the lines of "USB power exceeded." I do not remember the exact wording, as I stopped receiving these messages. This is why I removed the headers, and once I realized my mouse and keyboard would still stop working randomly, I plugged them back in. So at the very least, my USB keyboard randomly spazzes out (the lights flicker on and off, and it doesn't respond to any inputs), and I am running out of options. Does anyone want to try to tackle this?
My specs:
Windows 7 Ultimate (64-bit)
COOLER MASTER HAF 932 Advanced RC-932-KKN5-GP Black Steel ATX Full Tower
ASRock Z75 Pro3 LGA 1155 Intel Z75 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i5-3450 Ivy Bridge 3.1GHz (3.5GHz Turbo) LGA 1155 77W Quad-Core Desktop Processor
G.SKILL Sniper Series 8GB (2 x 4GB) 240-Pin DDR3 SDRAM DDR3 2133 (PC3 17000) Desktop Memory Model F3-17000CL11D-8GBSR
Western Digital WD Green WD8000AARS 800GB 5400 RPM SATA 3.0Gb/s 3.5" Internal Hard Drive -Bare Drive
Western Digital WD Green WD5000AZDX 500GB IntelliPower SATA 6.0Gb/s 3.5" Internal Hard Drive -Bare Drive
EVGA 01G-P3-1556-KR GeForce GTX 550 Ti (Fermi) FPB 1GB 192-bit GDDR5 PCI Express 2.0 x16 HDCP Ready SLI Support Video Card
XFX Core Edition PRO650W (P1-650S-NLB9) 650W ATX12V 2.2 & ESP12V 2.91 (PSU)
Razer Lycosa Mirror Gaming Keyboard
Logitech G500 10 Buttons Dual-mode Scroll Wheel USB Wired Laser Gaming Mouse

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic