Hi Alex,
Because After Effects is just a compositing program, you can’t “flatten” layers like you can in Photoshop (unless there’s a way unbeknownst to me). You can group the layers together by Pre-composing them, however that won’t make the file size smaller.
If you want your file to be smaller, you will need to render it out, not as .avi, but as something that compresses the video. I recommend rendering it as a .mov (Quicktime Format). It will make the file size a lot smaller, while still retaining a good amount of quality.
However, I suggest that you experiment with the different types of formats to render to. Either way, you will need to stop rendering it out to .avi if it is the final render, unless of course if it is going into an editing program like Sony Vegas, Final Cut Pro, etc.
Hope this helps,
Jack Howard