I got a friend who is doing PhD at one of the prestigious universities. Two and half years back we were classmates in graduate studies. I have good relations with him. I started working for industry and he is doing PhD. He has good credentials as far his research and academic records are concerned. There is PhD vacancy at the same university but in different department. I need to submit two recommendation letters. Is it a good idea to take recommendation letter from him? Will it increase the chance of getting selected for that position?
No, it is not a good idea to ask your friend to write a letter for you.
Recommendation letters for graduate admissions should be written by people experienced within the field, who know you well enough to form a clear opinion of your preparation and potential for graduate work in your chosen field. In almost all cases, they should be faculty members with whom you have worked closely, or at a minimum, taken classes with.
Having your friend write the letter would be useless:
He is working in a different field and would not know what skills are needed in your field.
He presumably has little or no experience of research of his own, so will not have as good a sense of the attributes that are needed for success in research in his own field, much less yours.
He is your personal friend and there would be doubts about his objectivity. (Ethically, if he were to write a letter for you, he should disclose that relationship.)
The fact that he is currently attending the same institution where you want to apply is irrelevant. That doesn't give his opinion any extra weight.
Beyond being useless, submitting a letter from your friend would lead an admissions committee to think one of two things:
You cannot find two faculty members who have a good opinion of your abilities, so you asked your friend instead. This would suggest that your preparation is extremely poor and your application should be rejected.
You are completely confused about how the application process works and did not understand that a letter from your friend would not be helpful. You have not done your research and probably don't really know what grad school would be like or why you want to go. They are not likely to accept such an application, either.