In John 17:4, Jesus prayed to the Father, "I have glorified You on the earth, having accomplished the work which You have given Me to do." Likewise, since Christians "have been bought with a price", they must therefore, "glorify God in [their] body." (1 Cor. 6:20)
How do we glorify God? People may invent many different ways to try and glorify God. But instead of doing what we think will glorify God, let's look to Jesus, our perfect example (1 Pet. 2:21). How did Jesus glorify God? He "accomplished the work" which was "given [Him] to do." (Jn. 17:4)
We glorify God by doing what He intends for us to do. The wise man summed up God's intention for us in the statement: "fear God and keep His commandments, because this applies to every person." (Eccl. 12:13)
God's intention for Christians is that "whatever [we] do in word or deed," we must "do all in the name of the Lord Jesus" (Col. 3:17). This does not mean we invent our own ways to glorify God and claim that we're doing them in the name of Christ. Those who do this will be condemned (Mt. 7:22-23). Jesus said that by doing this, they are not glorifying God, but rather are practicing lawlessness.
We glorify God by doing His will. His will has been revealed in Scripture (1 Cor. 2:10-13). Doing these things not only brings glory to God (Mt. 5:16), but will also result in our eternal reward from Him (Mt. 7:21).