The poem uses alliteration to bring its images to life, whether they're terrifying—like the chaotic scene of the fire itself—or more pleasant, like a day of rest in the house that has since burned down. This device, along with consonance and assonance, also lends the poem a sense of music.
The alliteration in line 3 is likely incidental (in that it's the result of grammatically necessary words like "was" and "with"), but this moment of increased lyricism also might evoke the noise and terror that wakes the speaker up; by repeating the whooshing /w/ sound, it's as though the speaker has suddenly sucked the air out of the poem.
The next example of alliteration is more striking. It comes in line 5, which describes the moment when the speaker was woken up by shouting and screaming:
That fearful sound of "fire" and "fire,"
Here, the poem turns up its own volume through both alliteration and diacope (the repetition of the word "fire"). The house-burning was noisy and terrifying, and so it makes sense for the poem to try and capture this panic through these quick, flitting /f/ sounds.
Later, alliteration simply draws readers' attention to the speaker's grief—which is so intense that she can "no longer look" at the ruins of her home—and to God's power ("grace") to "give" and "take" from human beings.
Finally, towards the end of the poem, the speaker reframes her loss by affirming that she already has a far superior house: the heavenly kingdom of the afterlife, created by God. This metaphor coincides with alliteration, as if in tribute to the "mighty[ness]" of that great "Architect" in the sky. Both line 43 and line 47 create this effect:
Thou hast a house on high erect
[...]
It's purchased and paid for too
Both examples are bold and clear, showing the strength of the speaker's faith in the fact that a better world awaits her in heaven.