I couldn't sleep.

Literal

Sleep [nominalizer-こと] [subject-が] could-not-do.

~ことができる ('to be able to') is a more formal alternative to the potential form. Here in negative past: 'could not.' More elegant than 眠れなかった but slightly stiffer.