A little bit more information about your background and situation would be helpful. Are you: a graduate student, a post-doc, a tenure-track professor? Are you teaching at a university? Are you teaching undergraduate or graduate courses? (I will assume that by "analysis" you mean something which is at the advanced undergraduate level, at least.)
I think the first reaction that most mathematicians will have to your question is "Oh, she should learn the material better." This is natural because part of being a mathematician is a constant desire to understand mathematics both more broadly and deeply than you presently do. So let's acknowledge that learning some more analysis couldn't be a bad idea. But it's not clear that that's the best answer to your qustion. Let's move on to other considerations.
First, it's a little unfortunate that you "have to teach" somewhat advanced courses in a discipline that you feel is far away from your training and current interests. Are there not other faculty who are more qualified to teach analysis courses than a young, inexperienced algebraist? If the answer is no, then that's no fault of yours, and it is somewhat valiant of you to be willing to pitch in outside of your core expertise.
If you are feeling worried by a lack of expertise, one strategy (not infallible, but worth considering) is to be open and honest with your students about this. Say at the beginning of the course that you are outside of your core knowledge but that's okay -- you do have plenty of training in learning mathematics in real time and solving problems. Tell them that you may not know the answer to each question they ask on the fly, but you are nevertheless more than capable of teaching the course and that at the end your knowledge will have increased just like theirs.
The prospect of teaching a course outside of your area of expertise becomes much more exciting and positive if you really do look on it as a learning opportunity. You have to trade in the mental image of the instructor as an omniscient sage whose job is to transport some platonically perfect mathematics from her head to those of the students for the image of a scholar who is always learning more, rethinking and reorganizing what she already knows, and presenting this material to the students and interacting with them in a temporal way.
In fact I was in a situation which sounds similar to yours: I am by training an arithmetic geometer (which is a kind of algebraist, I think) and as a postdoc less than two years out of my PhD I taught a second semester undergraduate analysis class. The big difference between my story and yours is that I wasn't required to do this -- on the contrary I campaigned quite actively (even a bit pushily, because it seemed necessary) to be able to teach an advanced class in any discipline, rather than the multivariable calculus / linear algebra that it seemed like I would otherwise get stuck with. I also had plenty of time to prepare for the course in advance, so I went to the library and thumbed through many different texts to get an idea of what the possibilities were. I had a fantastic time teaching the course, and my understanding of real analysis is much stronger now than it was before. (This was also the first course for which I typed up rather extensive lecture notes: scroll down to Real Analysis II on http://www.math.uga.edu/~pete/expositions.html to see them.)
The final thing I want to emphasize is that not being able to answer a question on the fly is not necessarily a sign of inadequate expertise: it may, on the contrary, be a very positive sign that the students are thinking in unexpected and novel ways. I remember my high school physics and calculus teacher (i.e., the same person taught me both): he was very adept at engaging the brightest students in deeper issues and getting them to think about problems that were a level or more above what was officially happening in the course. Often several students would stay with him after class and try to figure out some tough issue with him on the spot. It was great, because he was treating us almost as though we were equals -- which we most certainly were not; he knew far more than all of us put together -- and we felt like we were really involved. Often we would ask him tough questions in class, questions that he didn't know the answer to on the spot, and he would usually think about them out loud and try to work them out, sometimes unsuccessfully. On rare occasions he would even get a little stuck in some derivation in his lecture and have to quit and move on to the next topic. He took great pride though in coming back the next day with a fantastic explanation. He was, of course, the best math and science teacher I ever had, and by the way he had a PhD in theoretical physics, so he was not in any reasonable sense underqualified to be teaching those classes!
If you think about it, getting asked a question that you don't know the answer to immediately (and if you don't know it immediately, there's no shame in not giving the answer in that class period -- how much time are you willing to spare standing silently and thinking before you give up at least temporarily? not very much time at all, I hope -- any question which has given you such pause is well over the heads of the majority of the class, who are just waiting for you to get on with it) is just about the most positive experience you can have in a classroom. One of the reasons that I can't get excited about teaching freshman calculus is that I know from long experience that anything that I find remotely interesting is going to be difficult (and worse, boring) for 95% of the students. The number of interesting questions that I get when teaching calculus is, very sadly, about one every two or three courses. By the way, I don't recall ever getting stumped in that real analysis class that I taught. I sincerely wish I had been -- it would have meant that the students were engaging with the material at a much higher level. By way of contrast, for each of the three days of the course I am currently teaching I have received at least one question that really caused me to think and in my answers say things that I thought were true but wasn't completely sure. (Sample question: let $p$ and $p'$ be distinct prime numbers. Are the rational numbers equipped with the $p$-adic topology and the rational numbers equipped with the $p'$-adic topology homeomorphic? Probably, right? But I wasn't and still am not completely sure.) This is fantastic -- I can't wait for tomorrow. By the way, the title of this course is (graduate) Number Theory II, i.e., I am supposed to be an expert on this.