Your friend is right; you weren't "just lucky," but God was watching over you and taking care of you. The Bible says, "Though I walk in the midst of trouble, you preserve my life" (Psalm 138:7).
The real question, however, is this: Why did God spare your life? Was it simply so you could go on living the same way you always have? I'm afraid many people in your situation end up doing exactly that, but I pray this won't be true of you. God spared you for a purpose, and the most important thing you can do is to seek that purpose and dedicate your life to it.
In other words, what is God trying to teach you through this experience? What does He want to do in your life? First, He wants you to realize that He loves you and has a plan for your life. You aren't here by chance, nor are you here just to live for yourself without any thought of God. God made you, and life's greatest joy comes from knowing Him and living for Him every day.
Then God wants you to come to know Him personally -- and you can, by asking Jesus Christ to come into your life. Only one thing separates us from God, and that is our sin. But by His death on the cross Christ destroyed that barrier sin had erected. Don't ignore God any longer, but by faith commit your life to Christ today. Then ask Him to help you live for Him every day.