CBT is aimed at breaking the cycle of insomnia. Poor sleep tends to lead to stress and anxious thoughts about not being able to sleep. This in turn leads to stress and tension, which leads to poor sleeping habits, such as the use of sleeping pills. This leads to worsening insomnia and so on.