Write it down!
A scrap of paper will be fine, or get a paper journal to make sure you're not running out of paper in case something really interesting happens.
Do not wait, write down at least some keywords immediately when you wake up.
There's short term and long term memory. During sleep, short term memory works just fine, but of all that you experience during sleep very little makes it to long term memory.
It is like remembering an easy WiFi password, just long enough to enter it. Next time you get to the same place, you probably forgot that password. If you want to remember something longer than a few fleeting moments, you often have to try a little harder.
A longer dream with multiple scenes may fade from memory while you're still writing it down. First write down the general outline in keywords. Also jot down tricky details as who exactly where in the dream, names of strangers, numbers, anything that's quickly forgotten.
With these keywords you will be able to remember everything else from the dream, which gives you time to write everything down.
Telling your dream to your partner works excellent. Added bonus: your partner remembers your dream too.
Some have tried voice recording, but speech-to-text technology isn't really good enough. It may be easier to return to sleep if you had an interesting dream in the middle of the night.