The Worm That Gnaws in the Night is a creature featured in the Cthulhu Mythos, appearing in the short story Shaggai by Lin Carter. It is a Great Old One that takes the form of a gigantic Graboid-like worm that eats away at the centre of Shaggai with the intent of destroying it after being summoned by the alien Shan.
The Worm is the dread "Dweller in the Pyramid" mentioned in the Pnakotic Manuscripts of Lomar, and may also be the "very worm that gnaws" mentioned in the Necronomicon of Abdul Alhazred.
It was summoned to the planet Shaggai by the aliens known as the Shan, but they were unable to control it and it burrowed to the centre of Shaggai, where it was discovered years later by the wizard Eibon when he visited the planet.
To his horror, he found that the worm was eating away at the center of Shaggai and would destroy it, and returned to Earth before this could happen. Soon after, Shaggai was destroyed, but not by the worm: the Outer God Ghroth released cosmic energy that caused Shaggai to explode.
It is possible that the worm died with Shaggai, but this is unconfirmed.