What has been mentioned in the narrations is that four thousand people have narrated from him, they did not use to be directly his students and have and direct interaction with him.
However, you should pay attention to the following points:
The time of Imam Sadeq (AS) Imammat (leadership) was Shia golden age. Due the conflicts that were happening between the Umayyad and Abbasi movement, the social atmosphere had provided such an opportunity for Imam in which he could train and raise numerous students and brought and fresh and new soul to the Shiite body.
Some of the Historians and scholars have expressed that four thousand people have quoted narrations from Imam Sadeq (AS), the historians have confessed the names of the trustworthy narrators who have quoted from Imam Sadeq (AS) despite their Differences in their opinions and beliefs about four thousand. As it can be inferred from this saying, the number of people who have quoted from him had been four thousand and that does not necessarily mean that all of them were his students. Some of them probably saw Imam for a short time and may have narrated something from him
In the science of hadith, the narrator (the one who quotes) and the one who is quoted as saying are also referred to as student and teacher; therefore, It is likely that what is considered as four thousand students for Imam Sadeq (AS) is taken from this expression. So, four thousand students for him is specifically based on the above mentioned expression, but there is no reason to prove this matter.
It is natural to know the students of Imam Sadeq (AS) as many as we want, since this claim has no effect on his personality, position and value, and in any case, we consider him in the highest position.
source : erfan.ir