Concise Bible Dictionary:

To become surety for another is condemned in the Proverbs as being unwise: “he that hateth suretiship is sure.” To be surety for a stranger is totally condemned (Prov. 6:11My son, if thou be surety for thy friend, if thou hast stricken thy hand with a stranger, (Proverbs 6:1); Prov. 11:1515He that is surety for a stranger shall smart for it: and he that hateth suretiship is sure. (Proverbs 11:15); Prov. 17:1818A man void of understanding striketh hands, and becometh surety in the presence of his friend. (Proverbs 17:18); Prov. 22:2626Be not thou one of them that strike hands, or of them that are sureties for debts. (Proverbs 22:26)). Many a Christian has suffered by being surety for a friend. It may be difficult to refuse, but it is unrighteousness unless the one who is surety can bear the loss if it should fall upon him.
The Psalmist asks God to be surety for him for good (Psa. 119:122122Be surety for thy servant for good: let not the proud oppress me. (Psalm 119:122)); and the Lord Jesus is made surety of a better testament, or covenant, than that made with Israel (Heb. 7:2222By so much was Jesus made a surety of a better testament. (Hebrews 7:22)). He is the powerful One who is certain of being able to bring to pass in its due time all that is foretold that He will do in carrying out the purpose of God.