I don't really know how much I can help here, but have you tried, doing you-know-what before bed?

As for in the dream, you're probably just not getting lucid enough. With more practice, you'll be able to avoid the distractions. Also look at the "avoiding sexual distractions" Tut on here.