Thank you for writing to Alterhéros.
Unfortunately, I don't think there is any easy solution to your problem. If your friend has told you he is gay, and therefore not interested in having a romantic relationship with you, then it's something you will have to accept, because being gay is not something you can change. I know that loving someone who doesn't love you back the same way is very hard, but, believe me, it's something you get over! Even if it seems difficult right now, in time, it will get easier. It sounds cliché, but it's true and many people have been through this at some point in their life. Maybe one day, you will be able to stay good friends, but for now, you need to accept that he is gay.
For now, spending less time with him may be easier for you and less hurtful. I would suggest spending more time with other friends or family members you are close to; it will take your mind off of this whole situation. Find things in your life you enjoy doing (art, music, sport, cooking, reading etc.) and focus on these activities. At first, it may seem like you are avoiding your feelings, but it may help you to see your pain from a distance. After a while, you will be able to look back on this and realize that there are so many other people in the world that you will like and that will like you back the same way.
I'm sorry I don't have any miracle solutions, but please know that you really do get over a broken heart in time. For now, take some time for you and focus on what makes you happy. Good luck Maricor! If you have any other questions, please write back.