Nonorganic insomnia is a frequent sleep disorder that has a high comorbidity with other psychiatric illnesses. In our sleep outpatient clinic, 41% of the patients showed neurotic, stress-related and somatoform disorders, 31% affective disorders and 1.6% schizophrenia. Sleep laboratory investigations in patients for diagnostic purposes and in normal subjects for the evaluation of drug effects suggest that changes in the sleep architecture of patients with nonorganic insomnia due to psychiatric disorders, compared with normal controls, are opposite to alterations induced by psychotropic drugs intended for their treatment, compared with placebo (key-lock principle). Evidence for this principle was found regarding nonorganic insomnia related to generalized anxiety disorder or panic disorders and benzodiazepines, depressive episodes, recurrent depression or dysthymia and sedative antidepressants and finally schizophrenia and sedative neuroleptics. Polysomnography (PSG) findings of other mental disorders are rather scarce and often depend upon the subtype and stage of the disease. In conclusion, sleep laboratory studies may be helpful for choosing the right drug for an individual insomniac patient.