Sleeping pills are sometimes prescribed for a short time for insomnia. But they usually stop working after several weeks and can lead to poor sleep if taken long-term.