One of the Bible's greatest truths (although it's one that's hard for us to accept sometimes) is that God is able to bring good out of even the most senseless tragedy. I pray this may be the case for you.
What do I mean? Simply this. All your life, you've lived for yourself, never thinking about God or doing anything to prepare for the inevitable moment when you will die and meet God. And it's very likely you would have continued this way the rest of your life, if it hadn't been for your friend's death. Now this tragedy has made you stop and think about your own need for God -- and if your friend's tragic death now causes you to turn to Christ, good will have come from it.
Only one thing will keep us out of heaven, and that is our sin. The problem, however, is that we can't cleanse ourselves of sin; it simply isn't possible. But Christ came into the world to do for us what we could never do for ourselves. He came to forgive us, cleanse us and open heaven's door for us, through His death and resurrection for us.
Don't cling to your sins any longer, but turn to Jesus Christ and open your heart and life to Him today. God's promise is for you: "For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life" (John 3:16).