Normally when you are over eager to attack, your defences are neglected. That has happenned to me.
I need to improve my defence

Try to control the center with your pawns immediately. Get all your minor pieces into the game and castle as soon as possible. Then look to attack.
Too many players at your level keep pushing their pawns forward randomly or launch attacks with very few pieces developed. These two habits leave you incredibly vulnerable to counter-attacks unless you never lose the initiative (and good luck with that). Studying a couple openings will help a lot with this.
Once you set up your pieces properly, if you still want to be defensive follow slvnfernando's advice and don't be over eager.

Try to control the center with your pawns immediately. Get all your minor pieces into the game and castle as soon as possible. Then look to attack.
Too many players at your level keep pushing their pawns forward randomly or launch attacks with very few pieces developed. These two habits leave you incredibly vulnerable to counter-attacks unless you never lose the initiative (and good luck with that). Studying a couple openings will help a lot with this.
Once you set up your pieces properly, if you still want to be defensive follow slvnfernando's advice and don't be over eager.
That's right! the best advice ,it helps me also,thanks!

Best defence is offence. I dont remember who said that quote.
I think that's based on Sun Tzu.

<!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } -->
When your opponent makes a move, ANY move, ask yourself “Why?”
He or she did it for a reason, even if it was a mistake. Once you know the reason, you will know the counter move. :)

Your king can be in the middle of the board with no defenders so long as your opponent's king is being utterly dominated! If you become a good enough attacker you won't have to worry about defending until you come across people that are just as good at defending as you are attacking. Kasparov once said that he used to attack because it was all he knew how to do. Now he attacks because it's the best way to play

As previously stated, the best defense is a good OFFENSE.
In chess, once you go on the D, you will more likely than not, LOSE.
With a RELENTLESS attack, you will seldom worry about playing REACTIVE chess and play (as all us above average chessplayers know) PROACTIVE chess, which is what WINS games.
The BEST way to improve your offensive game is to set your program to MAXIMUM attack and play it every day. You cannot learn to attack by playing defensive players.
THINK ABOUT THAT ONE.

Nonsense. An overall balance is required as it is in just about everything in the universe. The idea that the best form of defence is attack only applys to the cream of the crop and that only appears to work because they're clearly more talented than their opponents.
As in football. Brazilian World Cup winning teams were never overly concerned with defence, this was because if you scored 5 goals they knew they could score 6. But that's Brazil. Even the defenders attacked.
I think the problem here is that Sgt Pepper is getting caught out in the counter attack.
Post 8 from Skwerly pretty much covers it with regards to what your opponent does. As for your own moves, pay attention to how they affect your pieces and the board as well. No use forking a couple of rooks with your knight if it leaves your queen with her dress around her ears, obviously. There are lots of positional pitfalls that are not so obvious though. To understand them is to be on the receiving end of it.
It's just like the old back rank mate, when I started playing that happened enough for me to notice it and now I watch out for it like I watch out for cars crossing the road.
Most important of all is to learn from the defeat, look at what move specifically allowed the chain of events that led to your demise. The burned hand teaches best.
Do you guys have any advice for improving my defence. Anything I should practice doing, or any tips?