In general, no treatment is necessary. However, if sleep talking is severe or persists over a long period of time, talk to your physician or health care provider about the problem. There may be an underlying medical explanation for your sleep talking (e.g. an undiagnosed sleep disorder, or debilitating anxiety or stress).
Certain measures can be taken to reduce the likelihood of a sleep talking episode. Following regular sleep schedule, getting adequate amounts of sleep, and practicing proper sleep hygiene can help reduce the frequency and severity of sleep talking. Also refrain from alcohol, heavy meals, and excessive amounts of stress to reduce sleep talking.
For bed partners and roommates, earplugs or white noise (such as a fan) may help.