I have my pit connected to sewer line ( I know not allowed ) however i just found out after 3- 4 years when I flush , some of the water traces down into my pit area via connection. Since main pipe has slight curve , water follows it in. This is reason for smell. Any ideas on how to correct this so water doesnt not go toward pump. I have attached pictures.

Why not just rotate the elbowed section in the middle pic counterclockwise until it's pitched downward, then you'll get no runoff. Use a couple of 45s to realign and return the drain pipe back to plumb and into the pit.