Can my diet affect my sleep while pregnant?

Yes. The obvious, avoid caffiene, including cocoa, chocolate. Heartburn is more common so decrease carbohydrates except the more complex. Spicey foods may cause more challenges in preg.
Weight gain. If you eat unhealthy and gain weight it could cause sleep apnea. Spicy foods will increase reflux symptoms and disrupt your sleep.