When designing larger projects with microcontrollers, it happens very often that the uC itself has not enough free pins to attach all the stuff you need to. Fortunally for plain IO-connections there is a simple solution: External shift registers.

Simply take four free IO pins on an AVR and connect them to a 74hc165 for inputs or 74hc595 for outputs. You can connect a high number of chips in a daisy-chain manner. The uC can now push some bits through these chips and they are attached to the 74hc595's outputs. The same way the uC can read the inputs from the 74hc165's.

This way, you can get a huge amount of input and output pins to use leds and buttons. Even an lcd-protocol or some slow SPI stuff can be realised. Just be aware that you have a trade-off between time and quantity. The more IOs you want, the slower the refresh-rate is. Also make sure that the cables are not longer than a few inches when working at high speed.

This piece of software can help you to get started with this technique. It does not use SPI-hardware of the ATMega-series (therefore being a bit slower). However, it's not relevant, which pins you chose.

The software as a c-file:
PexIO v.0.5: PexIO-0.5.zip