Middle Child syndrome!!! She gets more of your attention when she does this and gets you to be concerned about her. She is controlling her body, in effect to control you. Don't forget, they are smarter than us and can manipulate us with a facial expression. If you ignore it, she will likely stop. She may wet herself a few times before she gives it up, though. Don't react, just go on with it as if there is no problem. Try setting aside a few five minute blocks during the day when you give her all of your attention. Converse with her, read a story, color a picture. Take the focus out of physical control and remind her that she can come to you to talk anytime she needs you.
If you are truly concerned that it is a physical problem, you might take her to the pediatrician and have her tested for a UTI. Best wishes!!