You’ve been there.
You’re having a normal conversation with a normal friend and then they drop this bomb on you:

More awkward than actually listening to this weird confession of the inner workings of your friend’s subconscious (that now apparently involve you) is forming some kind of intelligent, meaningful response.
Here are a couple options:
a) Goal: Avoid situation, but allow for future sharing of dreams that do not involve you.
Response: “Oh wow, pirates, huh? [Relate pirates to any other topic in the history of mankind, other than dreams].”
b) Goal: Do not encourage repeated behavior.
Response: Act like the conversation never existed. Begin talking about your problems at work.