The length of a dream depends on the length of the Random Eye Movement portion of the sleep cycle. The full sleep cycle repeats every 90 minutes. The REM portion of sleep is the last one, and can last anywhere from 5 to 45 minutes.
Time is one of the most distorted elements of dreaming. Dreams can continue from one sleep period to the next. This creates sequential dreams, which can add to the time distortion. When combined with the fact that dreams can continue from one sleep phase to the next, this can make some dreams feel like they last much longer than they do.