In Matthew 26:41, Jesus told His disciples to pray so that they would not enter into the temptation of the flesh.
The weakness of Peter’s flesh was due to his lack of prayer.
It wasn't in Peter’s heart to deny Jesus, he wanted to give his life for Him, and had he prayed, God would have pulled out what was in his heart and caused his flesh to overcome. Romans 8:27
2 Chronicles 16:9 For the eyes of the Lord run to and fro throughout the whole earth, to shew himself strong in the behalf of them whose heart is perfect toward him…
God doesn’t look on your flesh; He looks on your heart! And if you will give Him time in prayer, He can get what’s in your heart to show up in your flesh.