The first thing to know is why static electricity occurs. At certain times of the year the air becomes dry having low humidity. The drop in humidity causes hair to dry out more making it prone to static.
A good way to prevent static is to maintain the moisture in your home by using a humidifier and make sure to use a fabric softener anti static product inn your laundry. The static occurring in clothes can transfer to your hair.
This will cut down on static from clothing, sheets and pillow cases or any other fabric you come in contact with. If you put something on that is loaded with static spray it with static guard to eliminate the problem.