It is narrated from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that the Prophet (peace and blessings be upon him) said: "No man should lie in bodily contact with another man (skin to skin, without a barrier), nor a woman with another woman."
Imam Ahmad (may Allah have mercy on him) also narrated it from Abd al-Razzaq (may Allah have mercy on him), from Isra'il (may Allah have mercy on him).
Imam Ahmad (may Allah have mercy on him) said: "Aswad did not narrate it as marfu' (attributed to the Prophet (peace and blessings be upon him))."
And he narrated it to us from Hasan (may Allah have mercy on him), from Simak (may Allah have mercy on him), from Ikrimah (may Allah have mercy on him), as mursal.
Abu Hatim al-Busti (may Allah have mercy on him) narrated it from Abu Ya'la al-Mawsili (may Allah have mercy on him), from al-Naqid (may Allah have mercy on him), from al-Zubayri (may Allah have mercy on him), from Isra'il (may Allah have mercy on him).
A supporting witness (shahid) for it is in Sahih Muslim in the narration of Abd al-Rahman bin Abi Sa'id (may Allah have mercy on him) from his father (Sayyiduna Abu Sa'id al-Khudri (may Allah be pleased with him)): "No man should lie uncovered with another man under one garment, nor a woman with another woman under one garment."
And the like of it has already been mentioned in the narration of Sulayman bin Fayruz al-Shaybani (may Allah have mercy on him).
Related hadith on this topic