In order to understand this system of philosophy we have to be familiar with 2 concepts. The concept of ataraxia and the concept of aponia. Ataraxia is Greek for a state tranquility, freedom from disturbance of judgement and freedom from fear. This state is achieved through knowledge. Aponia is another Greek term that means absence of pain. So, for Epicurus, the combination of these 2 states constitutes the key to achieve happiness in its highest form.
For Epicurus all good and bad derive from sensation. The sensations that lead to pleasure are good and the sensations that lead to pain are bad. This has been misinterpreted as a rampant pursuit for pleasure, however, Epicurus was an advocate for moderation because he stated that excessive plasure leads to pain. Examples of this are gluttony, which leads to gastrointestinal discomfort and lust, which leads to eventual sexual dissatisfaction with the partner. In Epicureanism the value of friendship is so important that having a circle of friends you can trust is one of the most important means for securing a tranquil life.
With respect to religion Epicurus was a visionary. 2300 years ago he embraced the atomic theory of Democritus and had a materialistic view of the world. He preached freedom from superstition in all its forms and stated that the gods, if they existed, they must be neutral entities. The famous Epicurean paradox states the following "Either God wants to abolish evil, and cannot; or he can, but does not want to. ... If he wants to, but cannot, he is impotent. If he can, but does not want to, he is wicked. ... If, as they say, God can abolish evil, and God really wants to do it, why is there evil in the world?" After the official acknowledgement of Christianity by Constantine, Epicureanism was repressed. Epicurus' theory that the gods did not affect human affairs had always been at odds with the fear-inspiring Christian God. Christianity got much of its philosophical foundation from the Stoics.