Essence of Nightshade is a medical substance used in small doses as an anti-anxiety formula, but large doses are fatal. A single drop added to a cup of wine will calm frayed nerves, and three drops will put a person into a deep, dreamless sleep. Ten drops, even diluted into a cup of wine, are fatal.
Cersei Lannister acquires a bottle from Grand Maester Pycelle when readying for the Battle of the Blackwater. Cersei almost uses the poison on Tommen Baratheon, to prevent him from being captured when the battle seems lost. When she is halted by the arrival of Tywin Lannister to announce victory she drops the bottle to the floor, smashing it.
When a report arrives to the Small Council about the massacre of the Starks at the Red Wedding, King Joffrey becomes so excited that he shockingly insults his grandfather and Hand of the King, Tywin Lannister. Willing himself to behave calmly, Tywin coldly says that the king is "tired" and orders him sent to his chambers to rest - and that Grand Maester Pycelle should administer him some Essence of Nightshade to make sure he sleeps. Joffrey futility shouts that he's not tired, then slinks away to bed.
In the books
In the A Song of Ice and Fire novels there is no specific medicine called "Essence of Nightshade": in the TV series, it appears to stand in for a variety of analgesic or anesthetic medicines which were present in the novels.
A medicine called "Sweetsleep" has slightly similar properties: it is used as an anticonvulsant and anxiolytic at low doses, though it can be dangerous at high dosages.
"Nightshade" has also been mentioned as a poison. The real life deadly nightshade plant, also known as belladonna, has similar properties. Unlike "Essence of Nightshade", this "Nightshade" poison has no medical properties.
When Tywin sent Joffrey to bed after he insulted him in the Small Council, in the books he told Pycelle to give him a substance known as "dreamwine", which is apparently just a very strong kind of wine, administered for medical purposes. It is flavored with exotic spices from Qarth.
- Sweetsleep on A Wiki of Ice and Fire (MAJOR spoilers from the books)
- Nightshade on A Wiki of Ice and Fire