Lighting Woes (Part 1)

Greetings everyone! I’ve been quietly lurking on the forums for some time now, but this would be my first post. I’ve been working on implementing tile based lighting/shadows in my current project (a 2d, side-scrolling, terraria esque sandbox game), and I think I may need some help, as my current method seems to be presenting a bit of a dilemma.

My current method of rendering lighting is by using a gradient “shadow” overlay for each block, including Empty tiles:

This seems to look good, until you consider that shadows overlay the background image as well:

Obviously, I don’t want a single campfire (or in this case, radioactive water block!) illuminating the background image which represents land/sky far off in the distance. For that matter, I don’t want to have to draw shadow blocks over the background either (which dims the stars, for example).

The obvious solution would be to not draw shadows over empty blocks, but then players and objects would appear bright and unshaded at night or in dark areas.

The background has to be drawn behind everything, but the “shadows” have to be drawn over everything; yet I don’t want the shadows to affect the background image. Is there any way around this, or will I have to redesign my lighting system?