Sleeping makes you forget sad things.

Literal

Sad things [topic-は] sleep [if-と] forget.

寝ると忘れる uses the habitual conditional と: 'when you sleep, you forget.' A folk-wisdom observation.