The traditional formal expression is "Please accept my sincere condolences on the death of your father".
However, it is just as good to write from your own feelings, keeping your message short. Try to recall some happy time spent with your friend and his father. Express sympathy for his loss.
Student or Learner