This is a little bit juvenile, but did prominent wig-wearers like Louis XIV remove their hairpieces very often? What were the mechanics of wearing elaborate wigs in bed?
Generally wigs were only worn in what we would consider formal occasions. For a tradesman this may be important meetings, court, church, dinners, etc. Anything where he'll be sure to be in a nice suit of clothes and well put together. The tavern, the races, or just working in his shop he may not. In the case of royalty, however, formal is all of their public life. Once retiring to bed and the clothing has been changed from a suit to bedclothes, the wig would be removed and likely replaced by a bed cap. No one slept in their wig, or for that matter the elaborate hairstyles. As for sex, it's a matter of how organized the affair is. Imagery of adulterous couples or amorous trists show the couple in varied states of clothed depending on how much time they assume to have.