Adding something more to the answers.
The important thing to remember here is that everyone, including Snape, believed Voldy was dead.
The following excerpt from HP & the Deathly Hallows - chapter Prince's Tale. Conversation between Dumbledore & Snape in Snape's memories
"You know how and why she died. Make sure, it was not in vain. Help me protect Lily's son"
"He does not need protection. The Dark Lord has gone - "
" - The Dark Lord will return, and Harry Potter will be in terrible danger when he does"
Snape loved Lily. That is the Iron Clad truth. IIRC, Snape, after having mentioned the Prophecy to Voldy, pleaded him to let Lily live & only kill Harry & his father.
Snape was not the kind of person to follow Voldy out of fear. Snape was ambitious & looked up to Voldy. Voldy could have yanked Lily away & killed Harry & let her live. But he didnt care. Snape was obviously devastated. And Voldy was gone, so no double agent opportunities were yet presented to him.
When Dumbledore tells him that Voldy will return & the boy, who has Lily's eyes, would be in great danger, Snape has an opportunity to redeem himself, avenge his love & prove his love for Lily more to himself than anyone else