You say you go to sleep while meditating .Once you go to sleep, you can do nothing about it. But while you are awake trying to keep away all thoughts. When you pass into sleep the state in which you were before falling sleep will continue when you wake up. You will continue where from you left off when you fell into slumber.—Maharishi Ramana.
Comments; Sometime sleep comes while meditating. We should avoid thoughts in practice. But sometime sleep comes into practice. But it will be only for some minutes and we should start after that. Now mind is at rest and you can start from that point. This is helpful in practice. But as mostly Saints told and I also find it very helpful if we do half or an hour practice before going to sleep at night. Then in the morning it will be very helpful for meditation.