Denise
I have been thinking on your post. I sleep very well so when I wake in the middle of the night thinking about something I know I need to answer .
First thing although I have a feeling it is puberity you are dealing with make an appointment for her to have a complete physical.
Second I feel that the not sleeping is very worrying to her she was telling you something with trying to take the sleeping pills. so deal with that first. my sudgestions will be time consuming for you but I think they might help.
Look at her diet. try to eliminate caffiene and as much sugar as you realistically can. read ingredients . those new energy drinks are loaded with both.
Todays kids are overwhelmed with homework and stress. if what it takes to get the homework done is for you to supervise it for a while and be right there to help then that is what you need to do. Maybe homework time can be while you are cooking dinner and have her sit right in the kitchen with you.. I understood her to be in 6th grade .is one of the nightly assignments reading for 30 minutes a night . if so plan out a block of 2 hours on the weekend and have her do it then that will free up half an hour every night.and make her fell a bit in control. because KIDS NEED EXERCISE and if she is not getting it during the week it will effect her sleep. so try to make sure she gets some time daily for that . Even if it is the both of you turning on some music and clowning around dancing.
Now to help with the sleep kind of go back to when she was small. insist on an early bed time but . start her off with a warm bath or shower maybe with lavender bath salts to relax her. then as a bed time snack a cup of camomile tea or hot cocoa. go into the bedroom with her and read to her for a few minutes something relaxing or just talk about pleasant thoughts . this will hopefully make her relax and fall of to sleep. I know these ideas are time consuming for you but it is my feeling that they will help her .
Please keep me posted Growing up is so hard on kids
good luck
Love Wolfie