Hi guys
Thanks a lot for all the answers! I think
friendlyhugstoall actually nailed it: The problem is not the "thing" itself, but the way I relate to it: I suffer from anxiety, and have started meditation to try and overcome it. It has worked wonders - within a month around 80% of my anxiety was gone. But I recently realized that this sleeping problem is simply a by-product of my anxiety, and not a by-product of meditation in itself.
I managed to defeat the problem about a week ago, simply by realizing that sleep and meditation were two much different states, and that I did not "meditate at night" as I thought - I was simply being manipulated by my anxiety. Once I realised that, I managed to just enter a state of indifference when going to sleep, and just using my willpower to gently zone out, into a state of relaxation and sleep, instead of a state of anxious focus on whatever might be hindering me from sleeping.
So far so good. But alas, a new problem has arisen - nobody said defeating anxiety was easy

. About 2 weeks ago, just a week before my experience described above, I decided to stay up all night, in order to tire my body and make me sleep better the other day (I couldnt sleep any way). I usually meditate in the morning, and when I meditated that morning (I used a mantra meditation instead of mindfulness meditation), I nearly fell asleep and woke up with a chock! Now that has produced the most peculiar effect ever: For a full week after that, every time I was very close to falling asleep (drifiting off), I would wake up with the same kind of chock, completely wakening me up.
This would go on for a full week, and typically I would get 2 hours of sleep one night, and then the next day I would just collapse in bed and get 7 hours, and then 2 hours the next day. Crazy stuff. I had trouble opening and closing my hands on the 6th day, due to sleep deprivation!..

The problem stopped about a week ago. But yesterday, when I was about to meditate, I felt very anxious about perhaps falling asleep when meditating. I know this is irrational: I've never been close to falling asleep while meditating, except that one time where I had been awake for 24 friggin hours. I know I would not fall asleep, and yet I still felt anxious. I felt the anxiety building inside me while meditating, but I was to afraid to shift my focus from the breath to deal with the anxiety. And voila: Now I have the same problem with waking up in a state of anxiety every time I am close to falling asleep..
The problem will probably fade out in a week or so, but I want to continue meditation, preferably without experiencing this problem again. I am sitting here at 9 in the morning typing, without having any sleep, and its becoming quite hard to feel my fingers

.
Anyone know what to do?