Sometimes when people realise they've become lucid, they become so excited that they actually wake up. Next time, if you realise that you're dreaming, try to stay calm and rub your hands together or touch a dream object to increase the lucidity. Heck, I know that some people actually say "lucidity 100%" in order to increase it. xD