The Enterprise is searching a binary star system in an effort to find the USS Brattain, a Federation science vessel which went missing a month previous. 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 discover that although everything is in working order, the ship still fails to move. Dr. Crusher determines that all of the Brattain's crew died at each other's hands. That night onward, Troi has trouble sleeping, encountering the same dream of a mysterious voice stating "Eyes in the dark, one moon circles". Troi starts to believe Hagan was influenced by the same dream.
Four days later, with the investigation stalled, Captain Picard decides that the time has come to move on, but the crew find the ship also stalled like the Brattain. Data discovers that both ships are trapped in a spatial phenomenon known as a "Tyken's Rift", and they can only escape through the force of a tremendous explosion. However, as they work at determining how to create this explosion, the crew starts becoming irritable and experiences hallucinations. Dr. Crusher realizes that everyone, but Troi, has failed to achieve R.E.M. sleep since entering the rift, leading to their current state. As violence begins to erupt around the ship, Picard assigns Data, who does not sleep or dream and is therefore unaffected, as acting Captain.
Data eventually attempts to use a pulse from the deflector aimed at the center of the rift to create the explosion, but this fails to produce any effect. As Data looks for other solutions with Troi, Troi gets an idea that her dreams of "eyes in the dark, one moon circling" is a description of a hydrogen atom. Data and Troi work out that there must be another ship from a psychic race trapped on the other side of the rift who is aware of their presence but looking for hydrogen to create an explosion. Troi goes to sleep to contact the other species through the dream, while Data vents hydrogen into the rift. An explosion soon occurs, and both the Enterprise and the alien ship are freed. As the crew recovers, Data returns the ship to Picard, but not before ordering everyone to get some sleep.