In breastfeeding, the milk only flows when the baby sucks. The suck is usually followed by a swallow and this greatly reduces the risk that milk will pool in the baby's mouth and enter the Eustachian tubes. With bottle feeding, the formula can flow even when the baby is not sucking and swallowing, leading to milk pooling in the mouth and increasing the risk that formula will enter the ears. This is one reason that bottles should never be propped-up for the baby. Even when babies are held during a bottle feeding it is possible for milk to enter the Eustachian tubes because babies are usually fed on their back.
Breastfed babies are usually on their side, or with their head slightly elevated during feedings.
Breastfeeding at night can not be compared to bottle propping because of the mechanics involved as well as the immune factors. Formula is much more irritating if it gets into the ear. Remember, it is a foreign substance, unlike breastmilk. Additionally the antibodies in breastmilk would tend to discourage the growth of bacteria, if it did get into the middle ear, unlike formula that has no antibodies. I encourage you to continue breastfeeding, especially through this illness, as your body will be producing antibodies specific to the bacteria that caused your baby's infection.