I heard from Rav Yehoshua Neuwirth ZTL (author of Shmiras Shabbos Khilchoso), who ran one of the largest loan gemachs in Israel, that the second part of the passuk explains the first part.
He explained (based on experience) as follows: Many people, when asked to sign as an arev (Guarantor ) for a loan for someone, especially for a friend, will not hesitate to do so even if they have no means of paying up the debt if necessary. They will say, "I know him, I trust him' I won't have to pay" - He's good for the loan, he never defaults" etc etc. They don't realize that signing as an arev (especially arev-kablan) means that you are assuming the debt on yourself. In order to do so, you need to be able to pay the debt.
The passuk says:
Do not be one of those who give their hand, Who stand surety for debts,
Lest your bed be taken from under you When you have no money to pay.
These last words tell us that the whole passuk is discussing someone who signs as an arev without having the money to pay the debt.
On the other hand, being an arev for someone, when you can be an arev, ie YOU are good for the loan, you have the means to pay it, and thus helping them obtain a loan when needed, is a big mitzvah!
[Note: This is the norm. There are certain exceptions, where helping someone obtain a loan is not only not a mitzvah but very detrimental.]