In light of what I’ve read in C. S. Lewis and other writers, I see two ways of praying for the dead.
(1) Because God’s character is so deeply wonderful and inexhaustible, a human creature might spend forever getting to know God better and never exhaust the Subject. No matter how far you pursue that quest, you will never run out of more God to know, to love, to reflect, to contemplate, or to serve. The more you pursue it and reflect it, the better you yourself will become.
If Heaven is dynamic, not static, and if knowing God better is a path that goes on forever, then growth in Heaven is both possible and desirable. And if growth in heaven is possible, then pray for your departed friends the same way you prayed for them while they were here: Pray for their growth and sanctification, the very means by which their joy might be full. Your, and their, capacity for joy is commensurate with your, and their, capacity for holiness, for Christlikeness. The more you are like Him, the holier you are. The holier you are, the more joy you can absorb and experience.
In short, even if your friends or family members live there rather than here, they still live, and there is no good reason not to pray for the living. While their salvation might be settled, and the sin that beset them be put away, that does not mean they are incapable of growing in God. It means that now nothing hinders their progress, and that your prayers might have even greater effect now than ever they did.
(2) Everyone knows what happened on September 11, 2001 in New York. Two jetliners, hijacked by terrorists, slammed into the World Trade Center, bringing down the twin towers and killing thousands of those inside. We all know it.
We do not know the eternal destiny of the souls who died that day. We do not know if, as their fate that morning slowly dawned on them in the minutes between when the first plane hit and the second tower fell, they sought God and his forgiveness and thereby found rest for their souls. We do not know if, in the final moments of earthly life, they did the right thing and found peace with God, turning to Him for their soul’s deliverance. Because we do not know, we can today, years after the fact, pray ardently to God for their salvation, and God, Who can hear then the prayers we pray now, might grant that ardent prayer even before it is prayed. God is not bound like we are to the temporal sequence. He can hear and grant our prayers before they are made, even before we are made. Indeed, our prayers are heard and granted even before the foundations of the world itself are laid.
But we cannot pray against knowledge, against the truth. We cannot, for example, pray that the planes are not hijacked or that they do not hit the towers. We cannot pray that the persons trapped inside do not die. We already know the answer: They were and they did. We already know the truth about such things, and the Spirit of Truth Himself, Who teaches us what we ought to pray, will not lead us to pray against the truth. Such a prayer might be well intentioned, but it does not come from God. Because we do not know the spiritual condition of those involved, we can interceded for them and, in light of that intercession, God might hear our prayer beforehand and grant our request years in advance of it being asked.
Pray for those who live here; pray for those who used to live here, but now live elsewhere. Praying for the dead is really praying for the living, and praying for the living makes perfectly good sense.