The term of the Prime Minister is not fixed, and he/she holds office during the pleasure of the President. However, this does not mean that the President can dismiss the Prime Minister at any time. So long as the prime minister enjoys the majority support in the Lok Sabha, he/she cannot be dismissed by the President. The full term of the Prime Minister is five years, which coincides with the normal life of the Lok Sabha. However, if he/she loses the confidence of the Lok Sabha, he/she must resign or the President can dismiss him/her.
To read more about the powers and functions of the Prime Minister & Council of Ministers, check the linked article.