Yup I sometimes accidentally fall asleep with mine on. The noise cancelling works even while not playing anything. Just make sure you don’t sleep on side and crush them but you should be fine as they’re pretty resilient to damage (except water).
AirPods Pro work way better for sleep due to low profile (mostly just using single one tho), but I've used big cans too. They do get damaged rather quickly (pads compress, drivers crackly all the time) and not comfy.
The kinds of noises that often keep people awake at home aren't really the strong suit for active noise cancellation technology, but it works well enough that there's a whole market for noise cancelling sleep aids. You're probably better off looking there than the Bose QC; ordinary headphones and pillows often don't agree.
best trick i know for this is to have another source of noise that you can tolerate (e.g. a fan). noise cancelling headphones are useful if you sleep on your back...