My plan for peaceful slumber was thwarted just last week when the old sash window above my bed rattled intermittently throughout the night. Too knackered to get up and fix it, too conscious to sleep soundly. I woke up early and exhausted, and jammed a wedge in the window gap as soon as I had the energy. The next night I slept like a baby.
Shoving a paper shim in between the window and the window frame dampened things well enough for me to continue to sleep.