How to keep external USB drives from sleeping (Windows 7) [duplicate]
Go into the Power Options in Control Panel, then click on "Change Plan Settings" for your plan, then there should be an option "Change advanced power settings", then look under the "Hard Disk" and "USB Settings" areas.
This one may not be the actual answer, but set your "Turn off Hard Disk after" to never (set 0), but I think the real one is to set "USB selective suspend settings" to "disabled" at least when plugged in...but maybe also when on battery if you are using it that way when it happens.
In response to your comment that it did not work, try this too. Go into device manager, to the USB root hubs, and turn off the save power option. Also try to do it for your disk too under hard disks (it may not have this option, but check anyway).
Some enclosures have this setting in the device itself. My Seagate has software to control this and other firmware features.