It's just the natural secretions of the eye which you wouldn't notice through the day, but at night it gathers into the corner of the eye and dries out to form "sleep." The eye needs these secretions to stop it drying out, to wash out foreign bodies such as dust etc and also to fight infection.