Prosecutors had accused the men of holding “deviant parties” and dressing in women’s clothes. Three were sentenced to eight years and the fourth to three years in prison.
Prosecutors have used a law banning “debauchery” to try homosexuals in the past.
Those accused of homosexuality are often forced to undergo medical tests to establish they are “habitual” gays, a practice rights groups have decried as abusive.
Homosexuality is not tolerated across the Middle East and much of Africa.