Madness

From Dungeon Master's Guide, pages 258-260.

In a typical campaign, characters aren't driven mad by the horrors they face and the carnage they inflict day after day, but sometimes the stress of being an adventurer can be too much to bear. If your campaign has a strong horror theme, you might want to use madness as a way to reinforce that theme, emphasizing the extraordinarily horrific nature of the threats the adventurers face.

Going Mad
Various magical effects can inflict madness on an otherwise stable mind. Certain spells, such as contact other plane and symbol, can cause insanity, and you can use the madness rules here instead of the spell effects in the Player's Handbook. Diseases, poisons, and planar effects such as psychic wind or the howling winds of Pandemonium can all inflict madness. Some artifacts can also break the psyche of a character who uses or becomes attuned to them.

Resisting a madness-inducing effect usually requires a Wisdom or Charisma saving throw. If your game includes the Sanity score, a creature makes a Sanity saving throw instead.

Madness Effects
Madness can be short-term, long-term, or indefinite. Most relatively mundane effects impose short-term madness, which lasts for just a few minutes. More horrific effects or cumulative effects can result in long-term or indefinite madness.
 * A character afflicted with short-term madness is subjected to an effect from the Short-Term Madness table for 1d10 minutes.
 * A character afflicted with long-term madness is subjected to an effect from the Long-Term Madness table for 1d10 x 10 hours.
 * A character afflicted with indefinite madness gains a new character flaw from the Indefinite Madness table that lasts until cured.

Curing Madness
A Calm Emotions spell can suppress the effects of madness, while a Lesser Restoration spell can rid a character of a short-term or long-term madness. Depending on the source of the madness, Remove Curse or Dispel Evil and Good might also prove effective. A Greater Restoration spell or more powerful magic is required to rid a character of indefinite madness.