“Thy will be done, on earth as it is in heaven.”
[No Lukan parallel]
Some suggest that this is really just the second half of the previous petition, “Thy kingdom come.” One major difference should be noted: The previous petition asks that God's will, in form of his rule, be done in our lives. This petition requests the manner or degree to which God's will be done—on earth as it is in heaven. In other words, perfectly. (D.A. Carson, Expositors Bible Commentary)
Here we again pledge ourselves to help bring about that which we request. As with hallowing God's name, we confess that we too want God's will in our lives. This request forms the basis for asking forgiveness later in the prayer.
We here commit ourselves not only to do God's will, but to discover what his will is—otherwise how can we know to do it?
In this sense, we are asking God to make us a people of the Bible who study, affirm, and practice its truths.
Jesus is the supreme example of the attitude he teaches here. He himself prayed, “Not my will, but thine be done” at his most crucial hour (Luke 22:42). He also told us, “I come not to do my own will but the will of him who sent me” (John 6:38).
Praying “if it be thy will” in our prayers has its basis, then, in this petition.
When Jesus taught us to pray in his name, he was not telling us to tack his name to the end of our requests as a way to get what we ask for. He was telling us to do precisely what this petition does, pray for and in God's will—that which is in accord with his name. In fact, tacking his name on the end of our prayers when those prayers are not in his will may in fact constitute taking his name in vain, which goes against what we learned about hallowing God's name.
Salvation itself depends on the reconciling of two wills: God's and our own. “Getting saved” happens when we surrender our wills to God's will by repenting and believing the gospel. Living the saved, sanctified life, also consists in this kind of harmony between our wills and his.
This petition gives us hope, for it implies that with God's help we may in fact be able to live without sinning. Why else would he tell us to pray it, if it were not possible?