No, you do not have to be baptized to be filled with the Holy Spirit. To prove this all we have to do is look at the Scriptures where the phrase, "filled with the Spirit," is used.
- Luke 1:15, “For he will be great in the sight of the Lord; and he will drink no wine or liquor, and he will be filled with the Holy Spirit while yet in his mother’s womb."
- Luke 1:41, "When Elizabeth heard Mary’s greeting, the baby leaped in her womb; and Elizabeth was filled with the Holy Spirit."
- Luke 1:67, "And his father Zacharias was filled with the Holy Spirit, and prophesied, saying . . . "
- Acts 2:4, "And they were all filled with the Holy Spirit and began to speak with other tongues, as the Spirit was giving them utterance."
- Acts 4:8, "Then Peter, filled with the Holy Spirit, said to them, “Rulers and elders of the people,"
- Acts 4:31, "And when they had prayed, the place where they had gathered together was shaken, and they were all filled with the Holy Spirit and began to speak the word of God with boldness."
- Acts 9:17, "So Ananias departed and entered the house, and after laying his hands on him said, “Brother Saul, the Lord Jesus, who appeared to you on the road by which you were coming, has sent me so that you may regain your sight and be filled with the Holy Spirit.”
- Acts 13:9, "But Saul, who was also known as Paul, filled with the Holy Spirit, fixed his gaze on him,"
- Acts 13:52, "And the disciples were continually filled with joy and with the Holy Spirit."
- Eph 5:18, "And do not get drunk with wine, for that is dissipation, but be filled with the Spirit,"
So, we can see that Jesus was filled with the Holy Spirit while He was in His mother's womb. Of course, He had not been baptized at that point. In Luke 1:41, we see that Elizabeth was filled with the Holy Spirit and she had not been baptized either. The same is true with Zacharias in Luke 1:67. In Acts 2:4, people were filled with the Holy Spirit and were not baptized until later on (2:38).
One of the evidences of being filled with the Holy Spirit is speaking in tongues--though speaking in tongues is not a necessary result of being filled with the Holy Spirit. When we look at another set of verses in Acts, we see something very interesting.
"While Peter was still speaking these words, the Holy Spirit fell upon all those who were listening to the message. 45 And all the circumcised believers who had come with Peter were amazed, because the gift of the Holy Spirit had been poured out upon the Gentiles also. 46 For they were hearing them speaking with tongues and exalting God. Then Peter answered, 47 “Surely no one can refuse the water for these to be baptized who have received the Holy Spirit just as we did, can he?” 48 And he ordered them to be baptized in the name of Jesus Christ. Then they asked him to stay on for a few days," (Acts 10:44-48).
It is obvious from the text that the Gentiles had already received the gift of the Holy Spirit and were speaking in tongues before they were baptized. Therefore, the answer is clear. It is not necessary to be baptized in order to be filled with the Holy Spirit.