score:8
That was because of the Peace treaty which was signed between the two nations, moderated by Soviet Union.
Following were the figures for losses of both nations:
India: 3000 men killed or captured by Pakistanis (Neutral). 8200 men Killed or captured by Pakistanis (Pakistani claims). Indian admission is not available.
Pakistan: 3800 men killed or captured by Indians (Neutral). 5259 men killed or captured by Indians (Indian claims) . Pakistani admission is not available.
As you can see, both sides held prisoners of each other, which can be assumed to be more or less the same figure (If we disregard the claims of both sides and entertain only the neutral claims). Since the war was over, it was imperative for both nations to reach a treaty to end hostilities and repatriate the prisoners.
What you say is true, India had captured presumably thousands of Pakistani soldiers. What you fail to note however, Pakistan had also taken presumably thousands of Indian soldiers prisoners.
Through mediation of Soviet Premier, Alexei Kosygin, leaders and delegates of both nations met in Tashkent, Uzbek SSR, USSR. A peace treaty, Tashkent Declaration was signed by the two belligerent nations.
In that treaty, it was agreed in clause VII:
The Prime Minister of India and the President of Pakistan have agreed that they give instructions to their respective authorities to carry out the repatriation of the prisoners of war.
Also as hinted by Siddant Kumar, both Pakistan and India were parties to Geneva Convention (Fourth one since 1950s) which states in Article 133:
ART. 133. β Internment shall cease as soon as possible after the close of hostilities.
So that's why Indians released Pakistani prisoners because: