One solution, although a bit expensive is to find a DMC-185x, 186x, 187x, or 188x board. With 5 or more axes you get an additional 16 digital IO ports and I think a few more analog ports. You may need to use a separate ribbon cable connected to a second connector on the board inside the computer to access additional ports.
From the user guide: The DMC-1750 through DMC-1780 and DMC-1850 through DMC-1880 controllers provide interface
circuitry for 16 optoisolated inputs, 8 TTL inputs, 16 TTL outputs, and 8 analog inputs with 12-bit
ADC (16-bit optional).