1 John 3:22 ESV and whatever we ask we receive from him, because we keep his commandments and do what pleases him.
Here the scripture tells us that we receive from God when we:
Keep His commandments
Do what pleases Him.
Observe that what pleases God may not necessarily be an explicit commandment: For instance David’s decision to build the temple was NOT a commandment but was extremely pleasing to God.
2 Samuel 7:1-9 ESV Now when the king lived in his house and the LORD had given him rest from all his surrounding enemies, (2) the king said to Nathan the prophet, “See now, I dwell in a house of cedar, but the ark of God dwells in a tent.” (3) And Nathan said to the king, “Go, do all that is in your heart, for the LORD is with you.” (4) But that same night the word of the LORD came to Nathan, (5) “Go and tell my servant David, ‘Thus says the LORD: Would you build me a house to dwell in? (6) I have not lived in a house since the day I brought up the people of Israel from Egypt to this day, but I have been moving about in a tent for my dwelling. (7) In all places where I have moved with all the people of Israel, did I speak a word with any of the judges of Israel, whom I commanded to shepherd my people Israel, saying, “Why have you not built me a house of cedar?”‘ (8) Now, therefore, thus you shall say to my servant David, ‘Thus says the LORD of hosts, I took you from the pasture, from following the sheep, that you should be prince over my people Israel. (9) And I have been with you wherever you went and have cut off all your enemies from before you. And I will make for you a great name, like the name of the great ones of the earth.
2 Samuel 7:11-16 ESV from the time that I appointed judges over my people Israel. And I will give you rest from all your enemies. Moreover, the LORD declares to you that the LORD will make you a house. (12) When your days are fulfilled and you lie down with your fathers, I will raise up your offspring after you, who shall come from your body, and I will establish his kingdom. (13) He shall build a house for my name, and I will establish the throne of his kingdom forever. (14) I will be to him a father, and he shall be to me a son. When he commits iniquity, I will discipline him with the rod of men, with the stripes of the sons of men, (15) but my steadfast love will not depart from him, as I took it from Saul, whom I put away from before you. (16) And your house and your kingdom shall be made sure forever before me. Your throne shall be established forever.'”
This same truth can be expressed as: what is lawful is what is commanded; but what is expedient is what is pleasing in God’s sight.
1 Corinthians 6:12 AMP Everything is permissible (allowable and lawful) for me; but not all things are helpful (good for me to do, expedient andprofitable when considered with other things). Everything is lawful for me, but I will not become the slave of anything or be brought under its power.
So to please God we go beyond just doing what we are commanded to do and in addition do what is pleasing in His sight.
How then do we know what is pleasing to Him since He would not have commanded us to do it?
We get to know what is pleasing in His sight by getting to understand His character: lovingkindness, righteousness and justice through His written Word as revealed by the Holy Spirit.
Jeremiah 9:23-24 ESV Thus says the LORD: “Let not the wise man boast in his wisdom, let not the mighty man boast in his might, let not the rich man boast in his riches, (24) but let him who boasts boast in this, that he understands and knows me, that I am the LORD who practices steadfast love, justice, and righteousness in the earth. For in these things I delight, declares the LORD.”
John 17:17 ESV Sanctify them in the truth; your word is truth.
John 16:13-14 ESV When the Spirit of truth comes, he will guide you into all the truth, for he will not speak on his own authority, but whatever he hears he will speak, and he will declare to you the things that are to come. (14) He will glorify me, for he will take what is mine and declare it to you.
So we please God by staying in close fellowship with the Holy Spirit through the Word, to receive what is pleasing His sight and then we do those things that are pleasing in His sight by the power of the Holy Spirit.
Practically we do this by frequently ‘washing our feet’ (at least once every six hours (2 Sam. 6.13, Mk. 13.35), frequently acknowledging the Holy Spirit in our thinking (at least once every conscious hour (Mt. 24.42) for mercy unto eternal life, praying in tongues frequently throughout the day as often as is practicable (1 Cor. 14.18) and habitual daily balanced bible reading.
This is what the Lord Jesus Himself did:
John 8:29 ESV And he who sent me is with me. He has not left me alone, for I always do the things that are pleasing to him.”
It is for this reason the Lord Jesus received mercy to triumph always!