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 or anti static product in your laundry. The static occurring in clothes transfers 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's loaded with static electricity, spray it with static guard to eliminate the problem.