In Shakespeare's time, mattresses were secured on bed frames by ropes when you pulled on the ropes the mattress tightened, making the bed firmer to sleep on. That's where the phrase, "goodnight, sleep tight" came from.