Matthew 21, verse 22 can and should be taken literally.
Let's look at the passage in context:
And Jesus answered and said to them, "Truly I say to you, if you have faith and do not doubt, you will not only do what was done to the fig tree, but even if you say to this mountain, 'Be taken up and cast into the sea,' it will happen. And all things you ask in prayer, believing, you will receive."
- Matthew 21:21-22
There is no apparent reason, from my perspective, that this passage should not be taken literally.
We are commanded to worship God with all of our minds (Matthew 22:37; Mark 12:30; Luke 10:27). If we are truly obeying this command, we will always be certain and completely without doubt about anything that God has told us to be true -- anything He has promised. However, we will always have some doubt about anything that God Himself has not told us to be true. Thus, we can be certain that when God has made a promise to us, it will come to pass. But that is the only kind of thing we can be certain about.
Has God promised me a Porsche?
No. He has not.
Can I honestly believe, without doubt, that He will give me one?
Not if I am worshiping Him with my mind as I have been commanded to do.
Has God promised me that if I repent and trust in Christ, He will forgive me for my sins?
Yes. He has. (Luke 24:47; Acts 2:38, 10:43; 1 John 1:9)
Can I honestly believe, without doubt, that my God will do this?
Yes, I can. And, if I am worshiping Him with my mind, I will.
Thus, if I ask God to forgive me of my sins, I can be certain that He will do exactly as I have asked. He has promised me He will! I can honestly ask believing and without doubting. I can therefore be guaranteed that every promise of God's that I ask for in such a manner, I will truly receive, just as He has stated, literally, in Matthew 21.
On the other hand, if I am worshiping God with all of my mind, I cannot honestly ask, believing and without doubt, for a Porsche. I will always, if I am worshiping God with all of my mind, have doubt that He will provide me with a Porsche, unless He some day promises to do so.
If we ask for what He has promised us, we will receive it. Do not doubt His promises!
However, if we ask for what He has not promised us, we cannot justifiably expect anything.