Obviously, it should be your goal for your son to sleep on his own. To encourage him to sleep on his own, I would offer your son a daily reward for sleeping in his bed all not long. In terms of why he pulls your hair, have you asked him? If so, what does he say? Being 4 years of age, he should have some verbal skills to be able to communicate his intent. Regardless, it is important that this behavior gets disciplined per occurrence.
If you feel that your son sleeps with you because he experiences anxiety, the anxiety needs to be addressed to fix this behavior. If you are unable to determine the root of this anxiety, it might be a good idea to have your son evaluated by a mental health professional.
Yes he does sleep with me. He starts in his bed and climbs in our bed in the middle of the night. I sleep to heavily to even notice his presence. However, forcing him to stop sharing our bed will solve the problem, but it doesn't tell me why he's doing, which is what I want to know.
By your post, it sounds like you allow your son to sleep with you. Let him sleep on his own in his own bed and the hair pulling won't be an issue during the night time hours. If this occurs during the day, make sure that you discipline the behavior by giving him a timeout per incident. A smack on the hand won't do.