One way to avoid nightmares is to avoid stress and maintain good sleeping habits.
(One way to avoid nightmares; is; to avoid stress and maintain good sleeping habits)
One way to avoid nightmares
is
to avoid stress and maintain good sleeping habits