The "sleep tight" part, comes from when there were no bed springs and instead, ropes, which had to be retied tied, often every day, when a bed was made, is what kept the mattresses from sagging...though I have heard that there is a different explanation of the word "tight" in this 100s of years old little good night wish. :-)
Like you, I had no idea what a bedbugs was back then either.
I’m a senior citizen, but I’m sure that expression is pretty old.