Anxiety and stress can make it hard to fall asleep. These may also explain your focus on your heartbeat. Try avoiding caffeine and alcohol. Stop using nicotine products if you use them. Be physically active, meditate, and reach out to family and friends. If maintaining a healthy lifestyle does not help quality of your sleep, see your doctor for a more in depth investigation of your sleep trouble.