I cannot speculate about the causes for his long history of head banging without much more information. What I can tell you is that if he were presently seen by medical professionals for this sleep-time head banging and these professionals knew nothing about his long history of head banging, they would probably suggest that he was experiencing rhythmic movement disorder (RMD). This disorder refers to a group of movements that usually occur at the beginning or end of sleep. These movements include head banging, body rocking, and headlong. Head banging is the most prominent movement in this disorder, sometimes occurring as violent front-to-back movements. In children, head banging is usually done into the pillow but it may also be done against the wall.
RMD usually first shows itself within the child's initial 9 months of life and decreases as the child ages. It's rare that it is still in evidence during adolescence or adulthood. RMD episodes can last from minutes to several hours. Kids don't usually injure themselves with RMD, although soft-tissue injury to the eyes and forehead of head banging mentally retarded children has been reported. On occasion, head banging may be the only observable symptom of a seizure disorder. Sometimes if RMD occurs when the child is awake in bed, you can reduce it by cutting back on the time the child spends in bed. In very serious, stubborn cases, there are behavioral techniques that can help as well as the very selective use of a group of drugs called benzodiazepines.
Ruth, it would be great if you took your boy to a specialist, preferably a pediatric neurologist or a doctor who treats childhood sleep problems. I know that once these doctors heard your son's history, and maybe even observed his head banging in a sleep laboratory, they could help him (and you) have a more peaceful sleep. Keep me posted as to his progress if you can.