Sanity is an indicator of how happy/healthy your sim is in The Sims 2. Things that cause sanity to decrease are low hygiene, low energy, hunger, needing the toilet and thirst. To improve sanity, sims can interact with objects that correspond to their needs. If your sim's sanity decreases to zero due to hygeine, thirst or hunger a ghostly figure will come and collect your sim, and you will resume gameplay in the Manager's Suite. If your sanity is emptied by needing the toilet or lack of sleep, you will wake up in a jail cell in Strangetown Jail. If you have 200 simoleons or more at the time, 200 simoleons will be deducted from your account for bail, but if you have insufficient funds, Mamma Hogg will bail you out for free.
By interacting with lots of sims in the way your aspiration requires, your sanity level can increase, making it decrease slower therefore becoming more resistant to the effects of Strangetown. Below is a list of the color your sanity meter will appear to be at each level.
Level 1 - Red
Level 2 - Green
Level 3 - Yellow
Level 4 - Silver
The color and level of the sanity increases at which the player completes his/her daily tasks, such as romancing other sims of opposite gender, calming down guests, cheering up sad guests, and restraining loopy ones. As the sanity bar color changes, users notice that it takes longer for them to achieve the next color each time they check their aspiration. The sanity bar also decreases faster when in the Desert.