The ending is sad for the Dreamer, but most of the book is not. Dostoevsky himself called it a "sentimental novel", and the four nights are told with tenderness and humor by a narrator who laughs at himself. The sadness builds up little by little and only weighs fully on the last page.
The humor is there from the First Night. The Dreamer says he has friends among the houses of the city, and that one of them, a little pink house, cried out to him plaintively that they were painting it yellow; he also says that, at the moment of approaching Nastenka, he would have said "Madam!" had he not known that the exclamation had already been used a thousand times in high-society novels. On the Fourth Night, the plans for a life together have their charm: he will rent the mezzanine and be her lodger, and she turns down the opera of the Barber, which had been the other man's outing.
The sadness comes from his loneliness, told a little at a time ("do you understand what it is to be alone?", on the Second Night), and from the outcome: the lodger appears, Nastenka runs to him, and in the Morning the letter arrives announcing the marriage. The Dreamer sees himself alone in the same room fifteen years from now.
Even so, the book does not end in complaint. He blesses Nastenka and asks whether a minute of happiness is little for a whole lifetime. Whoever reads the ending as gratitude comes away with melancholy; whoever reads it as the last reverie of a lonely man comes away with sadness. Both readings fit the text.