Not being able to sleep at night—especially many nights in a row—is agonizing. When I asked experts what to do about it, they told me that cognitive behavioral therapy for insomnia, or CBT-I, is the gold-standard way to reset your sleep schedule. Here's a look at the steps involved, plus how long it takes to see results.