As far as what to do, here's my advice.
1. Go to the visitation, go to the funeral. (I have never forgiven a close friend of mine who was too busy to come to my father's funeral.)
2. Don't offer any silly opinions like, "at least she's not suffering anymore", or "she's in a better place", or "you will feel better in a while", or "if you think that's bad, my so and so stories" (That sort of shit drove me crazy.)
3. Avoid getting drunk, only makes it worse.
4. Listen more than you speak.
5. Tell your friend to bring some photo albums to the funeral parlour. Better times.
6. Keep in mind, in about 2 weeks time, it will be far far far worse for him than it is now. I know that's hard to believe, but once the hoopla has died down, your thoughts are like a freight train. Call your friend up then and spend some time with him then too.
7. Read your friend. If he's feeling really depressed, don't try to joke around him. That drove me crazy. Everyone is different though. I couldn't handle people laughing and kibitzing at the funeral. Everyone is different however, I agree. Which is why I say, read your friend.
8. As weird and unbelievable as this may seem, in both cases when my parents died, the vultures descend. You might be amazed (I was) how they come out of the woodwork asking you if they can some of the deceased's belongings. I had one uncle, one cousin's wife do this. Fuck that. Tell your friend not do anything right now other than funeral. Don't promise anyone anything, don't start figuring on estates, don't start going through stuff.