When one of your closest friends experiences the loss of a loved one, it's hard to know how to react. You want to be there for them as much as they need you to be, but you also don't want to overstep your boundaries during their time of mourning. You don't want to say the wrong things, and you want to give them space, but you want them to know that you would do anything for them.
The worst part about experiencing a friend's loss is that you feel their heartbreak. It's difficult to know that someone you love is hurting so much, and to know that there isn't a lot that you can do to make them hurt any less. You can always comfort them, but you can't make the hard truth that they have lost someone they love any easier. If you too know the person they have lost, it's hard to distinguish between your own emotions and loss and knowing that they might be having a harder time with the loss. Take some time to mourn for yourself if needed, and then be as strong as you can be for your friend.
The best thing that you can do for your friend in their time of mourning is to do everything that you can for them to make their day to day life a little easier. Relieve them from the burden of certain responsibilities so that he or she can mourn without having to worry about their other commitments. Scope out the situation and decide when you should be there with them and when they would probably rather be alone or with family. Be strong for them so that they can be weak, and make sure they know that they don't have to put on a strong face for your benefit.
Don't overdo it. After some time has passed, if they say that they are okay, let them be okay. Don't be a constant reminder to them that they have lost a loved one. Dealing with the loss of a loved one is a very personal coping process and it takes a different amount of time for everyone. Be there when they have a bad day, and treat them normally whenever they are having a good day. The truth is, you will never really know how they are feeling, but you should know them well enough to know when they need some extra support and when they want to just carry on with their lives. Don't victimize them, because whenever they are ready, they will want things to go back to normal as much as possible.