I have experienced this as well. When it happens to me I just wake up and stay awake for a few more minutes... Maybe read something or just have a wank. When I fall back asleep I mostly dream and in this way I have attained lucidity a few times.