How can you marry an undocumented alien and get a green card for him if he has been here for 3 years?

It really doesn't matter how long the alien has been here. It follows the same process. You get married and then apply to adjust the status. the fee would depend on how this person entered the country, legally or illegally. As far as I know it would take about six months for a temporary residency and then after two years you would have the final interview in which you would be given the permanent residency. good luck!