As long as it still sounds good and flows with the first name.
In terms of 'feminine' and 'masculine', I'd just want the names to match. So for a boy with a girl middle name I'd want the first name to be somewhat feminine too (still a boy name, but stylistically matched with the middle name) and vice versa. I see a lot of girl combos with that problem, where they use a boyish name but combine it with something frilly and girly. I think the idea is "the kid can pick which name to use depending on which one fits their personality", but then the name doesn't work at all. "
Charlotte Riley" will never make sense as a name even if
Riley is established as unisex because they styles don't fit. An opposite gender middle name *can* sound good, but the first and middle names have to be the same style, otherwise it's just unattractive. So I think names like
Ethan and
Toby would need some short, snappy, boyish girl first names to work but boy names like
Isidore,
Alastair, and
Jasper would work well as middle names for girls with frillier first names like
Charlotte,
Sophia,
Isabel, etc.
Mary and
Guadalupe make sense, I assume those would be used as a boy's middle name for religious reasons.
Ethan and
Toby don't seem to 'make sense' to me in that same way, and I wouldn't choose either of those, but I can see using something like
James for a girl's middle name. Another one that comes to mind is
Mars (as in the god and the planet, but I've also heard it used as a nickname for girl names starting with
Mar-). Also dittoing
Hope and
Fern as boys middle names from another comment.
For the most part I do think middle names should be usable. They can definitely be "weirder" than first names, but I think it's just a good idea to give your baby a middle name they can use if they don't like their first name. At least a nickname for the middle name should be usable.