“Holding on” implies continued efforts and persistence in some direction. Holding on to something requires focus, passion and extreme willingness to do that thing. The going can get tough and the circumstances do get adverse but someone if you have the passion, willingness and your utmost commitment towards something, you will hold on to it, no matter what. Holding on to something is all about keeping something in your reins and within your reach.
Holding on is also used for a relationship. Sticking to a relationship and staying committed to a person in spite of several complications in the relationship implies holding on to it. But the suggested advice is that you should call it quits before you get so attached to the other person that your survival after break-up becomes difficult. Holding on to some relationship when it gets dysfunctional and kills your peace of mind is not the right thing to do.