40 seems to be a common number....wasn't it the same amount of days that Moses fasted and went up Mt. Sinai to receive the ten commandments from God and Elijah spent 40 days fasting in the wilderness?(they were also at the transfiguration with Jesus.)At this early point in Jesus' mission or career, I wonder what He might have been praying for. Guidance for the day, definitely.
Patience for dealing with the crowds? Wisdom to teach the people and lead the first four disciples? Discernment in selecting the others?
Did He miss his family, maybe? Was he praying for them, too? Was he giving thanks for the angels who had tended him in those 40 days? We can only speculate of course.
Maybe Jesus just sat quietly in the presence of God and listened for God's voice. This, too, is prayer.
The number 40 in Judaism represents a period of probation, trial and chastisement.....Israel tested God by their disobedience in the dessert, but it was the Devil that tested Jesus' obedience.