Sometimes we need God's forgiveness for things we did wrong, and sometimes we need His forgiveness for things we didn't do but should have done.
And the good news of the Gospel is this: God is willing to forgive both kinds of sin. He is willing to forgive us when we do something wrong, and He also is willing to forgive us when we fail to do something right. Don't hesitate to turn to Him and ask Him to forgive you for not doing more to help your friend. You can trust God's promise in His Word: "If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness" (1 John 1:9).
How is this possible? It's possible for one reason: God sent His only Son into the world to become the final and complete sacrifice for our sins. We deserve to die for our sins, but Christ died in our place. Invite Him into your heart today. The Bible says, "To all who received him, to those who believed in his name, he gave the right to become children of God" (John 1:12).
At the same time, don't take upon yourself a burden you don't deserve. Yes, perhaps you could have done more for your friend–but he also was responsible for taking the path he did. Ask God to help you learn from this tragedy and to be more sensitive to those who are trapped by drugs or other destructive choices. Most of all, point them to Jesus, who alone can give them hope.