Thousands were brought to the obedience of faith. But neither Peter's words, nor the miracle they witnessed, could have produced such effects, had not the Holy Spirit been given.
Sinners, when their eyes are opened, cannot but be pricked to the heart for sin and cannot but feel an inward uneasiness.
The apostle told them to repent of their sins, and to openly acknowledge their belief in Jesus as the Messiah, by being baptized in his name. Thus professing their faith in Him, they would receive remission of their sins, and partake of the gifts and graces of the Holy Spirit.
To separate from wicked people, is the only way to save ourselves from them.
Those who repent of their sins, and give up themselves to Jesus Christ, must prove their sincerity by breaking off from the wicked.
Adapted from Matthew Henry's Bible Commentary