As a natural-born nightowl since birth, I've fought sleeplessness all my life.
1. Read all ingredients on any packaged food and stay away from anything with MSG- related content. These may be disguised as "flavoring," "natural flavoring," "hydrolyzed vegetable protein," etc. MSG and its pseudonyms are pretty strong mental stimulants and will keep your mind racing like mad even while you're absolutely exhausted. I used to keep a small jar of Accent (pure MSG) in my office so if I was feeling dull and if, let's say, a meeting was coming up where I needed to sharpen up, I'd put about a quarter inch pile of it in the palm of my hand and lick it off. Overdoing the amount gives me a headache, and don't do it if you're watching your sodium intake. Lots of chinese food contains MSG, so avoid that and don't trust them when you say "No MSG" and they nod and dutifully write it down on their order pad. There will be MSG in your food whether you want it or not. (And asking for decaf coffee at any restaurant is no guarantee that it will actually be decaf when you get it.)
2. There's a whole bunch of things which keep me awake besides that. Vitamin C, Paprika, and many other spices will do it for me. This has been observed in myself over many decades, and I don't care if you want "experimental proof" of this. It's a fact borne of long self-observation and finding these little sneaky things which keep me awake. Interestingly, garlic doesn't bother me that much, but onions do... I note that onions contain lots of Vitamin C, but garlic not so much.
3. For the short term, yes, tryptophane works, or at least most of the time. The FDA banned tryptophane a couple of years ago and I was furious and resorted to purchasing tryptophane as an "animal tranquilizer" from a Vet supply house. That worked fine, but the stuff I got from a health food store recently (the FDA "unbanned" it a couple of years later) does not work as well. I got some Jenne-o turkey ham from the supermarket and if I'm needing to get relaxed enough to sleep, I slice off a hunk of turkey ham and eat it. Seems to be effective.
4. I occasionally will take a half of an over-the-counter sleep aid pill, and while they work reliably, they make me feel dopey the next day and seem to affect my vision slightly. In general, I hate taking pills of any kind in their full dose, and have a pill cutter to halve them.
5. There is no set time when a stimulant, like coffee or tea wears off completely. It's a matter of what the "half-life" is in your body, and this varies with your metabolism, sensitivity to that chemical, and the amount ingested. Some people say "four hours" for coffee, others say "twelve hours," etc, but it depends. For me, coffee doesn't bother me that much, but I will avoid it "later in the day" if I know I've got to sleep well that evening. And yes, I mean "half-life" just like with radioactive decay. It's the same logarithmic function.
6. Background noise such as with white noise generators sometimes help, and I frequently drop off in bed with the TV on a quiet TV station (no shoot-'em-ups), but this is not 100% reliable. Just keep the volume down so you can just barely understand the dialog.
Now that I'm retired, all this isn't all that significant and I have reverted to my natural "ad libitum" sleep schedule, where I'm usually up until 5Am, then go to sleep for about five hours and get up naturally around ten-ten-thirty. But I'm in a very quiet situation here in my isolated senior citizen's apartment. Lucky me --after a lifetime of fighting insomnia and having my life revolve around a daily "up-and-at-'em" schedule.
For what it's worth... and I'm not kidding about watching the ingredients in foods.
Terry, 230RN