As someone with a tolerance, I've learned that consuming too close to bedtime will cause me to have difficulty falling asleep, and also not enter REM sleep.
However, by consuming throughout the day on a daily basis but stopping by late afternoon or early evening, my sleep and dreaming is vastly improved.