My only advice would be to give your friend space and time to heal, and maintain consistency with your boundaries.
There is no way to guarantee the longevity of a friendship, and the more complicated it becomes the harder it is to keep it from fracturing. Sex, money, cohabitation...