Sensing tilt using accelerometer alone

Here's a link that might give you some insight into how it's done in smart phones:
http://www.freescale.com/files/sensors/doc/app_note/AN3461.pdf.

It appears to be a bit more complex than what's been described so far, but maybe not a whole lot more complex. In particular, for any particular orientation of the accelerometer, there are two different values of pitch and roll that could describe the device's orientation, depending on whether you treat it as pitch followed by roll, or as roll followed by pitch. You'll find some general formulas. You'll also find a discussion of how a phone selects between portrait and landscape modes, which seems to be what you wanted in the first place. It looks to be a lot simpler than determining precise values for pitch and roll.