Why have you been talking in your sleep?

Oh ooh! You have been talking in your sleep again. Hopefully, you didn't say something stupid or embarrassing. How is talking in your sleep even possible? What causes us to talk in our sleep and can you treat this?