In Sonnet 29, the speaker spends the first eight lines lamenting his "outcast state." He feels that other men have more skill ("art"), more friends, or more reason (hope) to feel good about themselves. But in line 9, he changes the tone and suggests, in line 10, that when he thinks upon his beloved, his state changes from the outcast, self-deprecating state to a heavenly state so wonderful that he would not trade it with kings.
In lines 10-12, the speaker, as he thinks about his beloved, uses the simile comparing himself to a lark.
Haply I think on thee, and then my state,
Like to the lark at break of day arising
From sullen earth, sings hymns at heaven's gate;
As he transitions from his self-loathing state ("From sullen earth,") to thinking of his beloved, he is moved to a much happier, higher plane of hope and love. The speaker compares this sense of rising to a higher place and the sense of awakening (from his melancholy) to the rising of the lark at dawn (rising of the day and of the sun). There is also the additional meaning of lark which means to do something for fun; this fits with his transition from a melancholy to a happy state.