When someone invites you to her home or a dinner out, she's going to some degree of trouble and expense to entertain you and share your company. This doesn't mean you need to worry or feel guilty about it, but it's just good manners to reciprocate and treat your host as well. Some events don't require reciprocation, and knowing the basic rules of etiquette can help you avoid anxiety and hurt feelings.
When to Reciprocate
If you are a guest at a small dinner party or are invited out by a friend, his treat, it's good manners to invite him to some kind of meal or small get-together you host. It doesn't need to be the same kind of event. You can reciprocate a casual at-home dinner with dessert and drinks or lunch in a restaurant if you'd prefer, but extend your invitation within three to four months after your friend treated you.
When Not to Reciprocate
If you are a guest at a large party, it's good manners to invite the host to your next large gathering. If you don't throw parties, you can invite the host to a smaller soiree, or you can just send a small thank-you gift and card instead. You don't need to reciprocate invitations to large, formal events like weddings, parties where you're the guest of honor, or events you have to pay to attend.