"Night Terrors" was written by Shari Goodhartz and was the 17th episode of the 4th season.
This is one of my favorite episodes because I find the subject of dreams and dreaming fascinating.
The Enterprise finds a science vessel adrift in space where the crew were found dead by each other's hands. They find one lone survivor, a Betazoid in a catatonic state. The engineering crew can find nothing wrong with the vessel's engines, yet it's inoperable so the captain decides to tow it to the nearest starbase.
While the doctor investigates the cause for the science vessel crew going mad, the Enterprise crew begins exhibiting signs of irritability, paranoia, and hallucinations. Troi has nightmares of a disembodied voice repeating "Eyes in the dark, one moon circles" as she attempts to telepathically communicate with the Betazoid scientist.
The bridge crew engages engines to leave, but finds itself adrift with no power. In a staff meeting, Data hypothesizes that they are caught in a "Tyken's Rift," an area of space that drains and sucks up energy, making their engines inoperable. But the doctor wants to know what's causing the crew to begin losing their mental faculties and fears they are heading for the same fate as the science vessel.
Different experiments to the engines proves unsuccessful as the crew's mental stability continues to decline. Personnel are at each other's throats and getting paranoid over their situation.
The Betazoid scientist repeats the phrase heard in Troi's dreams and she realizes that it's a message. Something out there is trying to communicate. Troi suggests to Data, who is immune to the area of space's effects, that it could be related to the twin star system they are in. The "one moon circles" resembles a hydrogen atom.
Troi goes back in REM sleep to communicate with the beings and tell them to ignite a burst of energy when they release hydrogen into the rift. When that is done, the ship is released from it's trap and Data orders the captain to get some sleep. Apparently, the telepathic waves the entity in space was transmitting were disrupting everyone's REM Sleep.
What I liked about this episode was that it demonstrated the importance of sleep, particularly the importance of REM (rapid eye movement) during sleep for our mental health and well-being. Dr. crusher explains this to the captain when she asks him if he recalls dreaming for the past several days. She hypothesizes correctly that no one is dreaming, except for Troi, and that is what's leading to everyone's mental breakdown.
One major flaw I found with this episode was that the element the thing needed was hydrogen, the most abundant element that we know of in our galaxy. It's not fully explained why it needed hydrogen but one can assume it was absent in this particular area of space.