In a heavy-bottomed saucepan, bring the milk to a slow simmer. It should be foamy and steamy and read 185˚F (85˚C) on a candy thermometer. Do not let it boil. Slowly pour in the lemon juice and stir for a few seconds, then remove from the heat. Allow to stand undisturbed for about 15 minutes until curds form.
Meanwhile, in a food processor, purée the onion, if using. Place the onion purée in a sieve set over a bowl and let it drain, reserving the liquid. Discard the solids.
Moisten a cheesecloth with water, wring it out, and use it to line a large colander. Gently ladle or pour the curds and liquid through the colander, then set aside to drain for 20-60 minutes until the curds have reached their desired level of dryness. Transfer to a bowl. If using, spoon the onion liquid over it.
Store in a sealed container in the refrigerator for up to three days.