I need to turn this:

into this:

It looks OK like that, but if you zoom in on that upper portion, the two surfaces on top and the bottom are not exactly aligned to the vertical wall. You can see it in particular with the lower surface... it's sticking out:

What I did to create that upper portion is I drew a curve around the basic shape, duplicated it and raised it, lofted the curves, then closed the top and bottom by using the planar tool. Well, now I realize that the planar tool doesn't really close the area accurately... Is there a way I can close it properly? Or is there another method I should use to create this shape? I tried doing it with polygons, and I guess it will work, but I need to cut lots and lots of edges into it in order to make it appear smooth.
Thanks for any help in advance!