The Prophet himself prayed for the deceased and declared that his prayer benefited them, as in the hadith of the mosque-sweeper in Sahih Muslim.
The majority of Ahl al-Sunna consider that the Prophet's hadith "three things remain" is not absolute. There are so many hadiths drawing lists in similar terms, such as : Seven people will be shaded on the day of Resurrection, and three things of your world have been made beloved to me, and women are betrothed for four reasons, and a woman enters Paradise for three reasons, and the earth is cursed except for four things, and so on and so forth. These do not have an absolute, exclusive value, but a general value. The sense is: Three MAIN acts continue to be fresh and current after one's book is closed, and Allah knows best.