"To the Virgins, to Make Much of Time" is a poem about how terribly quickly time passes—a potentially painful topic that the speaker softens with lighthearted, joyful sounds. The alliteration here adds musicality to the poem's warnings, but also helps to emphasize the speaker's more serious point.
For example, take a look at the alliteration in lines 3-4:
And this same flower that smiles today
Tomorrow will be dying.
The crisp alliterative /t/ sounds here, like the ticking of a clock, suggest just how quickly "tomorrow" follows on "today." Similarly, the repeated /r/ of "The sooner will his race be run" speeds up the pace of line 7, hurrying the reader along as fast as the sunset the line describes.
Something similar happens in lines 10-11, where the lively "warmer" blood of youth transitions into "the worse, and worst / Times" of later life. Here, the alliterative link between those /w/ sounds makes it clear that there's a thin line indeed between summery warmth and the worst times. (That echo on "worse" and "worst" is also an example of polyptoton—see the Poetic Devices entry on repetition for more on that.)
Another connection between the poem's ominous and cheerful moods comes in the final stanza, when the speaker decides to give some straightforward advice: "while ye may, go marry." That /m/ link between a warning "may" and a celebratory "marry" is right at the heart of the poem's philosophy. There's plenty in life to be enjoyed, the speaker insists—but one's got to snatch one's pleasures while one can!