In Macbeth, sleeplessness has to do with guilt. In fact, in Act 3, Scene 2, Macbeth tells Lady Macbeth that, "Duncan is in his grave./ After life's fitful fever he sleeps well" (III.ii.24-25). Duncan has nothing to be guilty of, so he rests in peace.
Macbeth and Lady Macbeth, on the other hand, are consumed with guilt and with fear of retribution. Lady Macbeth tells Macbeth that the reason he is hallucinating is a lack of sleep. "You lack the season of all natures, sleep" (III.iv.140). It is likely that Macbeth's guilt and fear have led to his sleeplessness which has led to his hallucination. This becomes cyclical, meaning that the hallucination can then lead to increased fear, more sleeplessness and so on.
Sleep is a recurring theme in this play. In Act 5, Lady Macbeth is so overcome with guilt that she begins sleepwalking. Both Macbeth and Lady Macbeth note how they no longer feel safe after they kill Duncan. And they can't sleep, dealing with that guilt and fear. Also, Macbeth murders Duncan in his sleep, when he is most vulnerable. Macbeth can't sleep after the murder because, as the new king and possibly suspected of regicide, he is afraid to be so vulnerable.
Just after Macbeth kills Duncan, in Act 2, Scene 2, Macbeth says he has murdered sleep, killing Duncan in this innocent and vulnerable state. Fittingly, Macbeth has, in a sense, murdered his own ability to sleep.