Dear Sandra,
There's only one practical solution to your problem. Your son needs to be falling asleep in his own bed and remaining in his own bed. You'll have to make this happen by consistently seeing that he does this. The problem isn't how he acts when he's in your bed; the problem is that he is in your bed at all. Be confident - you can change this, if you have the will to do it.
I concur with your thought that young children do not know why they act in particular ways. In general, they act in order to meet some need (as do all human beings), and generally they act in their own vested interest. The key, then, is to develop a plan whereby it is in the child's vested interest to do what the parent is expecting. That is a different thing from having the youngster fear the parent.
My son has issues such as these. They can also (and probably do) affect his performance at school. Intervention is needed. Please visit my web site. I have some information listed on SID.
www.geocities.com/denisev2/