I'm still a newbie, so I feel your pain. I really do. Pretty often, actually. But you will absolutely get better.

The best advice that I've gotten, and I have to repeat it to myself pretty often, is as Tali suggests ... scan the trail ahead. It's easy to focus on a spot, and then not be prepared to handle the spot immediately after. When I find myself not riding smart, this is usually what I'm forgetting.

The next best help I got this season was getting behind the saddle. I ride a hardtail, bars near saddle height. I took a weekend women's riding class locally. Day two was riding a fairly short trail, and hitting each of the 'obstacles' over and over again. It took somebody watching me to tell me that what I thought was 'down and back', really wasn't down and back enough. This helped me a bunch with the downhill switchbacks. I ride XC, and don't really have the patience to deal with moving the seat up or down every time the grade changes, but I would expect experimenting with moving the seat down would probably make you feel more confident on the downhills.

I ride the same trails pretty often too. Mostly due to limited time to ride, but there's an up-side to that too. Each time I ride a familiar section of trail I try to do one thing better than the last time. Mini goals. I hadn't ridden 'ladders' before, and it took me riding a particular trail three times this summer before I was able to ride a couple of the more intimidating ones. (and they're still nothing to brag about).

And when you're riding with people, don't let yourself feel rushed by the speed of the group you're riding with. Take a minute to go back over a particular section until you get it.

Don't let yourself get frustrated, which would totally defeat the fun of being out there riding. It takes time to get good at anything, mountain biking isn't an exception.