To the annoyance of people around me I have no trouble sleeping on long haul flights. And I don't take any fancy medication to do so. Having traveled a lot I've come to the conclusion that sleeping on a plane is a matter of attitude and a little preparation. This post is not for people who travel business or first class. It's for the average stiff who, like me, travels hundreds of thousands of miles in economy class.
First the gear. I put this here because everyone thinks that buying stuff is the vital element. This isn't actually true, the important bit is mental, but buying stuff might be a salve that'll make you work on the mental stuff later.
To create the conditions suitable for sleep you need: quiet, darkness, comfort and warmth. These are all hard things to come by on a jet, but much can be done do get close to good conditions.
This is cheap and expensive: I use ear plugs plus noise canceling headphones. Even with good quality ear plugs the noise canceling headphones will cut out sounds (particularly hissing sounds). I typically use silicone ear plugs because they mould to your ear shape and then I wear Bose QuietComfort 3 headphones. I'm not recommending specific brands though, just get good quality ear plugs and good quality headphones.
With those on and in you've got quiet.
Avoid the free blindfold that's given to passengers in economy class. They are usually ill fitting and uncomfortable with tiny elastic straps. Just buy a good blindfold which is wide enough to cover your eyes completely (including round the side of your head and above your eyebrows), that fits snugly around the nose (best if there is material that flaps down along the nose to keep out light) and has a wide, adjustable strap. Such as these.
Also make sure that the blindfold really cuts light: test it by shining a torch in your eyes while wearing it.
Now you have dark.
Get a neck pillow. I fly with one sewn by a member of my family, but you can just go buy one. I avoid the inflatable ones because they tend to be uncomfortable. It's worth the carry on space to have a good neck pillow (and they squash easily).
Wear it 'backwards' (i.e. with the slot pointing backwards so that your head can flop forward onto it. You'll still be able to lean sideways onto it to rest your head, but when you are asleep your head will move forward without you realizing.
I usually find that the blanket given by the airline is enough to keep me warm on a flight. If the flight is empty I'll steal a second one. One goes around by stomach, chest, legs with the seat belt fastened on the outside so that you will not be awakened by a flight attendant checking the belt. The other goes around by shoulders to keep my back and upper arms warm.
It's very important to keep your feet warm, but don't do it with your shoes on. To sleep comfortably you need to loosen your clothes. I loosen collar, cuffs and waist (undoing my belt and lowering my fly: looks odd to you, but it's under a blanket so no one else need to know) and I remove my shoes and socks.
To keep my feet warm I travel with a pair of sport socks that are two sizes too big for me. These slip on easily, don't constrict my ankles, and keep me warm.
You want the best seat available: that means avoiding people walking over you (so you need a window seat), with lots of leg room (a bulkhead or exit row), that reclines (some seats on some aircraft have limited recline). Since you can choose your seat with most airlines online (often weeks in advance) do so.
To find out which seats are best use SeatGuru. SeatGuru has seat maps for all the airlines showing which seats are good or bad. I recently flew from San Francisco to London on British Airways and used SeatGuru to choose seat 29A (here's the seat map). 29A is an exit row seat with a half row of seats in front of it. Your legs stick out further even than a bulkhead seat. It reclines normally and is by the window.
Get in the Zone
The rule of sleeping on a plane is that that is all you do. You do not eat, you do not read, you do not watch a movie, you do not think about the time: you do nothing but sleep.
If you need to eat, do it at the airport before you board. You are not going to waste time waiting for the onboard meal when you could be sleeping. I prefer to eat at the airport and have a single drink (such as a beer). Do not drink anything caffeinated. I avoid caffeine for about four hours before each flight. Then I'll wait at the gate. Once onboard immediately use the toilet to avoid needing to go a little later (also the toilets are at their cleanest then).
Then sit down and prepare to sleep by getting out all the gear above. After take off recline the seat and prepare to sleep. Tell the person sitting next to you that you are going to sleep and do not need waking up for meals (at least once a helpful person has woken me for a meal I didn't want), tell the crew that you do not want any food now or before landing (you can always change your mind about the latter if you are awake when breakfast is served).
Do not think about the time. Last week when leaving San Francisco it was about 1730 which is much too early to sleep (think that and you'll stress yourself thinking you can't go to sleep yet), in the UK it was 0130 which is much too late to go to sleep (think that and you'll stress yourself thinking of sleep you've missed). But the flight was over ten hours. The right thing to think is: oh, 10 hours of sleep, that'll do me good. But do not look at your watch and think about the flight time left. Just close your eyes, put on the blindfold, shut out the noise and relax.
Of course, relaxing is hard, but I find that something simple like alternate nostril breathing works wonders to calm me down. The yogi probably won't tell you but the beer also helps.
PS It's important to know how to unblock your ears because blocked ears can be painful. Here's a good description.