I'm no doctor but sleeplessness can be a physical condition or a psychological condition. For myself, there have been periods of my life where I was unable to sleep for different reasons: job stress, busy agenda, or just alot on my mind. I tried to break any bad habits concerning sleep that I had and it has helped. The psychological method is the best way to try to fix things first; dependency on sleep aids like pills is a route to addiction. Not good.
Number one and the most important (for me): the bed is for sleeping. Yeah, you can fool around with your wife/girlfriend too but don't watch TV or read entire books there. Trying to sleep with the TV on is bad too. It may put some folks to sleep but subconsciously, you're still involved all night long. I don't rest as well and still feel tired in the morning.
Number two: Establish a consistent sleep habit. If you feel tired at any point in the evening, it's not a bad thing to just go ahead and go to bed. Fighting sleep is another form of sleep deprivation. I've knocked out at 7:30pm and slept until morning plenty of times. Just give your body what it wants.
Number three: Plan your time better. Make time for projects/family/work. Decide when to turn each of those on and when to turn each of those off. If you're spinning in a circle trying to get more done than you have alloted time for, then you'll always feel frustrated and try to force results. Realize that sleep is something you have to plan for too. If you don't allot time for sleep, then the other stuff is going to suffer because of that. Sure, there will be exceptions but don't let them become rules. If you have kids, then God help you; I have no experience with that situation.
Hope this helps.