Hello, my name is Judith. Thank you for this opportunity to answer your questions.
You can give a letter of invitation to your friend to visit you and an Affidavit of Support.
The affidavit of support is at this link
A letter of invitation would include the information in the sample at this website
However, your friend would also need to bring with him proof of holding a job back in his home country and a letter from the employer stating how long he has worked at the job, what his job title is, what his job duties are, how much he is paid, and that the employer is giving him vacation time to come to the US for a visit.
He has to also bring what ever documentation he has that he has a residence in his country that he owns or rents and has no intention of abandoning.
He cannot come to the US with the intention of staying, marrying you and living here. He has the burden of proving he has compelling ties to his country that will make him have to go back.
If he says he is coming here to see his US girlfriend, he will not be given a visa because the consul will believe he is coming here to marry and stay.