Reference: Surah Al-Kahf – Quran, Chapter 18, Verse 22: Arabic and English Translation
22. (Some) say they were three, the dog being the fourth among them; (others) say they were five, the dog being the sixth, guessing at the unseen; (yet others) say they were seven, the dog being the eighth. Say (O Muhammad ): “My Lord knows best their number; none knows them but a few.” So debate not (about their number, etc.) except with the clear proof (which We have revealed to you). And consult not any of them (people of the Scripture, Jews and Christians) about (the affair of) the people of the Cave. (Translation by Muhsin Khan / Hilali)
Some will say concerning them: “They were three and their dog, the fourth”; and some will say: “They were five, and their dog, the sixth” — all this being merely guesswork; and still others will say: “They were seven, and their dog, the eighth.” Say: “My Lord knows their number best. Only a few know their correct number. So do not dispute concerning their number, but stick to what is evident, and do not question anyone about them.” (Translation by Abu Al-Alaa Maududi)
(Some) say they were three, the dog being the fourth among them; (others) say they were five, the dog being the sixth,- doubtfully guessing at the unknown; (yet others) say they were seven, the dog being the eighth. Say thou: “My Lord knoweth best their number; It is but few that know their (real case).” Enter not, therefore, into controversies concerning them, except on a matter that is clear, nor consult any of them about (the affair of) the Sleepers. (Translation by Yusuf Ali)


See Full Surah Al-Kahf