The Enterprise is searching a binary star system in an effort to locate the USS Brattain, a Federation science vessel which went missing a month previously. The crew locates the ship, but the Brattain is derelict, and all the crew are dead save one: the ship's Betazoid science adviser, Andrus Hagan, who is discovered hiding in a room just off the bridge. Hagan has somehow survived, but he has been shaken by the experience and is in a profound catatonic state.
Counselor Deanna Troi tries to use her telepathy to contact Hagan. Meanwhile, Geordi and Data set to work repairing the Brattain but are amazed to discover that everything is in working order. Nonetheless, they cannot get the ship to move.
Conducting her own research, Dr. Crusher determines that all of the Brattain's crew died at each other's hands.
That night, Counselor Troi has difficulty sleeping. She is having a recurring nightmare, wherein she is aloft amongst dark and disconcerting clouds. In the strange mist she hears a voice repeating the words, "Eyes in the dark. One moon circles."
Four days later, with the investigation stalled, Captain Picard decides that the time has come to move on. However, the Enterprise seems to now be suffering the same problem as the Brattain. The ship's engines are apparently in good working order, but propulsion is not functional. In addition, the crew is becoming increasingly irritable.
After considerable study, and despite an increasingly exasperated crew, Data determines that the Enterprise and the Brattain are caught in a spatial phenomenon known as a "Tyken's Rift." Only a tremendous explosion would provide enough force to get the ship free from the rift's influence. Data suggests that an energy burst from the ship's deflector might provide enough power.
At this point the crew begins to suffer from a series of nightmarish hallucinations. Picard hallucinates that the turbolift is collapsing on him; Commander Riker imagines there are snakes in his bed. After Dr. Crusher has a hallucination of her own, she realizes what's happening. Ever since their entrapment in the rift, none of the crew have been able to enter R.E.M. sleep; none of the crew have been able to dream. Without this natural function, they will all gradually go insane. The only exceptions are Counselor Troi (who continues to experience her recurring nightmare) and Data (who requires no sleep).
Data powers up the deflector array and fires the planned burst. There is no effectâthe ship is not freed. With much of the command staff now incapacitated, Data becomes the acting Captain.
The crew begins to come unglued. A fight breaks out in Ten-Forward. Worf, ashamed of his growing fear, attempts suicide, but he is talked out of it by Troi.
Finally, in a blink of inspiration, Troi realizes that her nightmare is actually a message being projected by an alien intelligence. She deduces that there is another ship caught on the other side of the rift, and someone on that vessel is attempting to communicate telepathically. This telepathic message is also interfering with the dreams of the other crewmembers. Deciphering the aliens' cryptic message, Troi and Data realize that the other ship needs hydrogen in order to create the explosion necessary to throw them clear; the message Eyes in the dark, One moon circles was meant to be a simile describing deuterium's (heavy hydrogen) single electron circling the nucleus composed of one proton and one neutron.
Data vents hydrogen from the Enterprise through its Bussard Collectors into the rift, and Troi sends a telepathic message to the aliens that the time has come for an attempt at escape. An explosion results, and both ships are released simultaneously. Data relinquishes command, but not before ordering Captain Picard and all other personnel to bed.