Sex can have a positive impact on mental health. It can reduce stress, improve sleep, and boost mood due to the release of endorphins and other feel-good hormones. It can also promote intimacy and emotional connection, which can contribute to overall mental well-being. However, it's important to note that these benefits depend on the context of the sexual activity - it should be consensual, safe, and enjoyable for all parties involved.