The Prophet ﷺ forbade solitude, that a man should spend the night alone or travel alone.
حدثنا أبو عبيدة الحداد عن عاصم بن محمد عن أبيه
أن النبي ﷺ نهى عن الوحدة أن يبيت الرجل وحده أو يسافر وحده
Its isnad is sahih. It is found in Majma al-Zawaid 8:104, where it is said, "Ahmad narrated it, and its narrators are the narrators of the Sahih." See also 5581.