There are two types of battery life. The first is how long your battery will run the computer for on a single charge. This is its capacity.
The other type of battery life is how long the battery will keep its capacity before it becomes uselessly low. Laptop batteries deteriorate and lose capacity over time. A battery that once lasted 3 hours on a single charge will eventually drop down to lasting almost no time at all. They keep their capacity best when they are kept cool and the charge is maintained at between 40 and 60%.
Unlike older style NiCad and NiMH batteries, which are not used in computers any more, modern Lithium chemistry batteries work best if they are never completely discharged. The fewer charge/discharge cycles the battery goes through, the longer it will last. They don't suffer from the "memory effect" which plagued NiCad batteries. Whenever possible, you should avoid discharging the battery to near 0% Any advice to do this is incorrect when applied to Lithium chemistry batteries, and can actually shorten the usable lifespan of the battery. Try to keep the battery between 40% and 60% charge.
It is also important to keep the battery cool. This means that, when you are running the computer using mains electricity from the wall socket, you should take the battery out. Batteries get very warm inside computers, and this warmth dramatically reduces the battery capacity over time. Only put the battery into the computer when you need to charge it up and when you actually need to run the computer on battery power. Take it out when you are not doing these things. (Unless the computer does not have a removable battery, in which case, obviously, you cannot do this.)
So, that pretty much covers battery lifespan. Now let's look at battery run-time.
When you are actually running the computer on battery, your friend is absolutely correct to say that turning down the brightness will make it last longer. The two main things that run the battery down are the screen and the hard drive. The screen uses a lot of power to make light, so if you turn the brightness down it makes less light and uses less power. The hard drive uses a lot of power to spin around its metal discs at high speed.
The processor uses a lot of power when it is working hard. Most computers automatically put the processor into a lower power mode when it isn't working hard, to save power. To avoid making the processor work too hard, only run programs you actually need to run, including any programs that run in the background.
Another power drain is wireless networking. If you are not accessing the internet, switch off the wireless. Many computers have a physical switch that does this, which makes it nice and easy. This should save a little bit of power.
Unplug any USB devices you are not using, because USB devices use a lot of power.
Sometimes it is possible to configure the hard drive to "spin down" (stop spinning) when it is not in use, which can also save power, but I don't recommend adjusting this because too many spin-downs can reduce the lifespan of the hard drive significantly. If you really want to save the power that the hard drive uses, switch to a solid-state disk, which should use much less.