Iphone 4 screen is dark and goes black?

It still functions, my alarm went off this morning and when i hold both buttons it resets and the apple logo pops up, then it dims and continues to dim to the point I can barely see it. At the unlock screen I swipe and before I can enter my passcode it goes completely black and is unresponsive to touching the screen. Anybody have any idea what this is. Sometimes when I push the home button it does a brief flash and then nothing unless I reset it again.

Replace it.