الْوَحْدَةُ خَيْرٌ مِنْ جَلِيسِ السُّوءِ، وَالْجَلِيسُ الصَّالِحُ خَيْرٌ مِنَ الْوَحْدَةِ، وَإِمْلَاءُ الْخَيْرِ خَيْرٌ مِنَ السُّكُوتِ، وَالسُّكُوتُ خَيْرٌ مِنْ إِمْلَاءِ الشَّرِّ (Bayhaqi)
Translation: Solitude is better than a bad companion; a good companion is better than solitude; speaking good is better than silence; and silence is better than uttering evil.
الْوَحْدَةُ — solitude; جَلِيسِ السُّوءِ — bad companion; الْجَلِيسُ الصَّالِحُ — good companion; السُّكُوتِ — silence; إِمْلَاءِ الْخَيْرِ — expressing/dictating good words.
Brief grammar: خَيْرٌ مِنْ repeatedly means “better than.” جَلِيسِ السُّوءِ is an iḍāfah, while الْجَلِيسُ الصَّالِحُ is a noun with its adjective.
In this four-part counsel, the decisive issue is the quality of company and speech, not merely whether one is alone or talking.