All I have ever heard in my Pentecostal life is that the purpose of baptism is the forgiveness of sins. I do not doubt that baptism involves the forgiveness of sins, but I think it is more proper to understand forgiveness as the consequence of the primary purpose of baptism: to unify us with Christ. Romans 6:1-6 and Galatians 3:27 are key texts: 

What shall we say then? Are we to remain in sin so that grace may increase? 6:2 Absolutely not! How can we who died to sin still live in it? 6:3 Or do you not know that as many as were baptized into Christ Jesus were baptized into his death? 6:4 Therefore we have been buried with him through baptism into death, in order that just as Christ was raised from the dead through the glory of the Father, so we too may live a new life. 6:5 For if we have become united with him in the likeness of his death, we will certainly also be united in the likeness of his resurrection. 6:6 We know that our old man was crucified with him so that the body of sin would no longer dominate us, so that we would no longer be enslaved to sin. (Rom 6:1-6) 

For all of you who were baptized into Christ have clothed yourselves with Christ. (Gal 3:27) 

According to Paul, when we are baptized in Jesus’ name we are clothed with Christ. We are baptized into Him, not merely unto Him. This union Paul describes appears to be a legal union. When we are baptized into Christ we join ourselves to Him so that what He accomplished spiritually on our behalf can be legally credited to us as if we had done it ourselves. When we are baptized into Christ we die to sin just as He died to sin; when we are baptized into Christ our old man is buried with Him; when we are baptized into Christ we are raised with Christ to newness of resurrection life (Notice how baptism is connected with Christ’s death, burial, and resurrection. This is in contradistinction to our normal way of explaining salvation wherein we die at repentance, are buried by baptism, and rise to new life in Spirit baptism. According to Paul baptism does all three.) Baptism allows for Christ’s victory over sin to be accounted to us as if it were our own. Understood in such a fashion it is obvious why Scripture says baptism if for the forgiveness of sins. It is the natural byproduct of this spiritual-legal transaction. To be dead to sin and experience new life in Christ is to be forgiven. So while forgiveness is definitely a purpose of baptism, it seems to be secondary in effect. It is a consequence of our union with Christ. 

As a side point, is anyone willing to take a stab at explaining the relationship between the forgiveness we receive when we repent of our sins, and the forgiveness we receive when we are united to Christ through baptism?