Hi Niwantha,
You need "a long time". You may also have heard of other time expressions such as "a short while", "..been a long while", "a long wait" and so on. In these expressions, "a" is needed.
However, "while", "wait" and "time" are uncountable nouns in the context of time. For example, you do not say: "Last week, he waited for two long times." So, why we do use "a"? The best explanation I can give is that "long wait", "long while" and "long time" describe a long episode between some time in the past and the present.
Example: Nice to see you after a long time.
I last saw you three years ago. After that, we were each busy with our lives for three years (a long episode). Now, I see you again.
I hope this helps.