The Sunnah is to say to the one who sneezes, “Yarhamuk Allah (may Allah have mercy on you)” if he sneezes and praises Allah (by saying “al-hamdu lillah (praise be to Allah”). If he does not praise Allah, then one should not say “Yarhamuk Allah” to him.
Al-Bukhaari (6221) and Muslim (2991) narrated that Anas ibn Maalik (may Allah be pleased with him) said: Two men sneezed in the presence of the Prophet (blessings and peace of Allah be upon him) and he said “Yarhamuk Allah” to one of them and not to the other. He was asked about that and he said: “This one praised Allah and that one did not praise Allah.”
And Muslim (2992) narrated that Abu Moosa (may Allah be pleased with him) said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “When one of you sneezes and praises Allaah, then say Yarhamuk Allaah to him, but if he does not praise Allaah, then do not say it to him.” End quote.
Al-Nawawi (may Allah have mercy on him) said:
This is a clear instruction to say “Yarhamuk Allah” if the one who sneezes praises Allah, and clearly forbids doing so if he does not praise Him. End quote.
if a non-Muslim sneezes and praises Allah, one should not say to him, “Yarhamuk Allah (may Allah have mercy on you)”; rather one should say to him: “Yahdeekum Allahu wa yuslih baalakum (may Allah guide you and set your affairs straight),” because of the reports narrated by Abu Dawood (5038), and by al-Tirmidhi (2739) who classed it as saheeh, from Abu Moosa (may Allah be pleased with him), who said: The Jews used to sneeze in the presence of the Prophet (blessings and peace of Allah be upon him) hoping that he would say to them, “May Allaah have mercy on you,” but he used to say: “May Allaah guide you and set your affairs straight.”.
Classed as saheeh by al-Albaani in Saheeh Abi Dawood.
Al-Haafiz (may Allah have mercy on him) said in al-Fath (10/604):
The hadeeth of Abu Moosa indicates that they are included in the general command to pray for the one who sneezes, but there is a special prayer for them, which is the prayer that they be guided and their affairs set straight. There is nothing wrong with that, and it is different from the prayer for Muslims, for they are the ones for whom mercy should be sought, unlike the kuffaar. End quote.
If a Muslim sneezes and praises Allah, it is the same whether someone prays for mercy for him or not, whether he is alone or is in a gathering of people. It is not prescribed for him to pray for mercy for himself (in this situation); rather he should praise Allah only (by saying “al-hamdu Lillah”).
Praying for mercy for oneself after saying “al-hamdu lillah” is not narrated in the Sunnah and it is not narrated from any of the Sahaabah as far as we know.
Al-Bukhaari and Muslim (1718) narrated that ‘Aa’ishah (may Allah be pleased with her) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever introduces anything into this matter of ours that is not part of it will have it rejected.”
If this is what was prescribed, the Prophet (blessings and peace of Allah be upon him) would have stated that, especially when there is a need to know the ruling concerning the matter.
And Allah knows best.