Instead of wanking, try just thinking about sex. I find this often helps shut down my higher brain functions, and puts me to sleep.
I should warn you thought that this will lead to your train of thought going astray as you are falling asleep, and the results can be a bit weird.