People who do this for a living (ie, biologists, naturalists, and other scientists who go out to jungles and live in the tree tops) either have a large safety net, or sleep with a harness hooked to a nearby branch.

TH