Background Migraine is a brain disorder with a multifaceted and unexplained association to sleep. Brain excitability likely changes periodically throughout the migraine cycle. In this study we examine the effect of insufficient sleep on neuronal excitability during the course of the migraine cycle. Methods We examined 54 migraine patients after two nights of eight-hour habitual sleep and two nights of four-hour restricted sleep in a randomised, blinded crossover study. We performed transcranial magnetic stimulation and measured cortical silent period, short- and long-interval intracortical inhibition, intracortical facilitation and short-latency afferent inhibition. We analysed how responses changed before and after attacks with linear mixed models. Results Short- interval intracortical inhibition was more reduced after sleep restriction compared to habitual sleep the shorter the time that had elapsed since the attack ( p = 0.041), and specifically in the postictal phase ( p = 0.013). Long-interval intracortical inhibition was more increased after sleep restriction with time closer before the attack ( p = 0.006), and specifically in the preictal phase ( p = 0.034). Short-latency afferent inhibition was more decreased after sleep restriction with time closer to the start of the attack ( p = 0.026). Conclusion Insufficient sleep in the period leading up to a migraine attack may cause dysfunction in cortical GABAergic inhibition. The results also suggest that migraine patients may have increased need for sufficient sleep during a migraine attack to maintain normal neurological function after the attack.