Thorny issue. There is always the risk of data loss, although if I don't have activity on the disks and no files are open most of the time I don't get any data loss. But then there are other times ....
External drives not being ejected when the system goes to sleep can be due to a number of things, some of which may be vendor specific.
1). In System Preferences, Energy Saver, do you have "put hard disks to sleep when possible"? If you haven't set this and turning the option on fixes the problem breathe a sign of relief.
2) If it doesn't work then the next step is to go to the vendor. Results can vary here.
I had some Seagate (or was it Western Digital, can't remember) external drives that continually gave this problem some years ago. There were a lot of discussions in forums about this problem. There was supposed to be a drive setting in their software to fix the problem but I never got it to work. I contacted Seagate support but the issue was never resolved.
Conclusion: a drive firmware issue Workaound: eject drives manually
2) My current Oyden Digital 5-Bay drive has the same problem. I contacted their support (which is terrific by the way) and they said that they had identified a problem where the drives would eject when the display went to sleep!. They were working on a firmware fix. Workaround: turn off automatic display sleep, eject drives manually, put display to sleep manually [I have a MacPro].
Since this is a JBOD with a total of 6 disks mounted (one disk has two partitions), I have a script under Finder Services which I run every night to automatically eject all of the disks.
3) My Promise Pegasus R6 seems to handle power off and sleep events with no problems.
What are the external disks that are showing the problem?