Download this app to your desktop
This application switches on or off auto brightness on Android 2.2+ phones. It saves the last manually set brightness level in order to return to that level when auto brightness is disabled.
This app is not a widget, so it won't show you the current setting visually, it won't take up extra memory, and it won't bog down your home screen.
You can also trigger it by holding down the search button (if any) on your phone.
Please email the developer with bugs or feedback. Auto Brightness Switch is open source and released under the GPL license. Patches and translations are welcome.