If your wife is an U.S. citizen, she may petition and sponsor you for lawful permanent residence depending on whether you entered the U.S with a visa or not. If not, a waiver would be necessary to overcome your inadmissibility. The friend would have to be a co-sponsor and meet the federal poverty guidelines threshold to sponsor you. You should consult an experienced immigration attorneys to guide you through the process.
The friend would need to meet the 125%-of-poverty-level guideline for a household of the friend's size (not yours or your wife's), and be a citizen or permanent resident living in the US to be a joint sponsor. See the guide on joint sponsorship linked to below.
Speak with an attorney for further guidance.
Assuming she qualifies to petition you and you otherwise qualify for immigration benefits, yes, your wife can file an I-864 and a friend can file an I-864 Affidavit of Support as a joint sponsor.
Attorney Jennifer Ahn's answer is to provide general information only, and should not be construed as legal advice on any subject matter. The content of this answer is not intended to substitute accurate legal advice, which is relevant to all the facts and circumstances of your specific case. This answer does not create an Attorney-Client relationship.