Your problem comes from the .*. If you only match every character that is not a ' or a " it will work: sed -ri "s/\[ ([0-9]+|(\x27|\x22)[^\x27\x22]*(\x27|\x22)) \]/[\1]/g" file.php
Even better (to take possible " or ' into account):
sed -ri "s/\[ ([0-9]+|(\x27|\x22)[^\2]*(\2)) \]/[\1]/g" file.php