Trigger warning: physical and emotional pain due to illness and death of relatives
You say you'd like to convey wishes of a peaceful death not when addressing your condolences to your friend's relatives, but rather when you inform someone you know about their death. I don't think that's a good idea, I think you should just tell them what happened instead. It seems that your wishes come from a place of hurt and there are other ways to expressing your feelings than making hypotheses on the painful loss.
I lost a dear friend of mine recently. He was an incredible person but I know he had to deal with a lot of personal issues. I just hope he went away peacefully
is likely to make people uncomfortable. As a species, we're really not good at dealing with others' painful emotions, and chances are they will not know how to react and what to say to make you feel better.
I lost my foster father in January 2018. He passed away after a decade of physical and emotional pain but his death still was sudden and very violent. I thought I had to tell people about it when they expressed their condolences - as a way to confirm that I was hurt and that it was hard to take. But it only made them uncomfortable.
Most people are hurt by the death of someone close, they don't have to explain why they feel that way. Since you will never know what people may have been through before passing away, it seems irrelevant if not a bit disrespectful to say you wish it was peaceful, especially since pain is a personal perception and what you think as painless may have been very dolorous for someone else. TL;DR: there is no way to know whether someone's death was peaceful, and assuming so might hurt their relatives.
From what I understand your aim is to sympathise with your late friend when announcing the news to your relatives. If so, you could say something along the lines of
I lost a dear friend of mine recently. He was an incredible person and I thought the best of him. I miss him.
as it would express your pain and your esteem for your late friend. This is what I used once I realized talking about my father's pain was making people uncomfortable because they didn't know how to deal with my feelings. People would then sympathise with me but wouldn't be surprised about the mention of the death circumstances.