Shakoo - I, too, have a horrible insomnia problem on top of having sleep apnea. The trick for me, when taking prescribed sleeping medication, is to immediately go to bed after taking the medicine. No more reading, no more computer, no TV. Take the medicine, go to ged, turn off the lights. It used to take me hours to go to sleep, and then there would be times that it seemed even when taken the medication I still would not sleep and friends would say I was "goofy" the next day.
There are many things that can interfere with sleep, some say eating 2 hours before bed can be disruptive if you have any problems with your digestive system. Some say things on your mind keep you up, aside from having therapy, I keep a list of "to do's" or reminders for the next day so I don't have to "try to remember" when I go to sleep. If you are a woman into menopause, menopause is one of the leading causes of insomnia (as is sleep apnea for men and woman) due to hormonal changes. Have you been to a sleep doctor? I was finally sent to a sleep doctor who sent me to a "sleep lab" who diagnosed my sleep apnea. Though your regular physician may be well meaning in presecribing sleeping pills, or your grabbing one of those over the counter ones, may be well meaning, a sleep specialist is the one who can best assess your personal situation.
I hope this helps.