If at sea and in no risk of being blown onto a lee shore:
Definitely get the sails down before the storm hits – you will have seen it coming if you were sailing in daylight. Depending on the size of the boat you may wish to rig a storm trysail (a tiny and ultra-heavy jib sail, rigged only to keep the boat head-to-wind) and throw out a sea anchor if you have one. Otherwise, just run under the bare pole. Without a sea anchor, it will be tough not to broach, so you will have to try to keep running before the wind. (You may need to keep the jib up to enable this, if you’re in a sloop-rigged boat.)
Try to stay below deck if possible. If you have to be on deck, wear a lifeline tied securely to a stanchion or pad eye, and a life jacket.
The lightning is less apt to kill you than the wind. But stay away from the mast, anyway.
If you’re close to shore or on a lake:
Get to shore, anchor or moor the boat (with the sails down) and get back in the house or car.